/** * @return GeoElement with same name (null if not found) */ public GeoElement getElementWithSameName() { GeoElement ge = kernel.lookupCasCellLabel(varName); if (ge == null) { ge = kernel.lookupLabel(varName); } return ge; }
private void removePossibleGeo(String label) { GeoElement geo = kernel.lookupLabel(label); if (geo != null) { geo.remove(); } }
@Override public boolean hasCoords() { GeoElement ge = kernel.lookupLabel(name, false, SymbolicMode.NONE); if (ge != null && !(ge instanceof GeoDummyVariable)) { return ge.hasCoords(); } return false; }
/** * @return first selected geo */ protected GeoElement getGeo() { return app.getKernel().lookupLabel(geoLabel); }
@Override public synchronized int getLineThickness(String objName) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return -1; } return geo.getLineThickness(); }
@Override public synchronized int getPointSize(String objName) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return -1; } if (geo instanceof PointProperties) { return ((PointProperties) geo).getPointSize(); } return -1; }
/** * Removes a previously set object listener for the given object. */ private synchronized void unregisterObjectListener( HashMap<GeoElement, JsScript> map, String objName) { if (map != null) { GeoElement geo = app.getKernel().lookupLabel(objName); if (geo != null) { map.remove(geo); } } }
@Override public synchronized boolean getLabelVisible(String objName) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return false; } return geo.isLabelVisible(); }
/** * Returns true if the object with the given name is independent. */ @Override public synchronized boolean isIndependent(String objName) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return false; } return geo.isIndependent(); }
/** * * @param label * label of GeoElement * @return screen reader output for GeoElement */ public String getScreenReaderOutput(String label) { GeoElement geo = kernel.lookupLabel(label); return geo.toValueString(StringTemplate.screenReader); }
private static boolean isFunction(String[] starr, int i, App app) { if (i >= starr.length - 1 || starr[i + 1].startsWith("[")) { return false; } if (app.getKernel().lookupLabel(starr[i]) != null) { return true; } return false; }
/** * Returns the object with the given name as a LaTeX string. */ @Override public synchronized String getLaTeXString(String objName) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return ""; } return geo.toValueString(StringTemplate.latexTemplate); }
/** * Shows or hides the object with the given name in the geometry window. */ @Override public synchronized void setVisible(String objName, boolean visible) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return; } geo.setEuclidianVisible(visible); geo.updateRepaint(); }
@Override public synchronized void setFilling(String objName, double filling) { if (filling < 0.0 || filling > 1.0) { return; } GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return; } geo.setAlphaValue(filling); geo.updateRepaint(); }
@Override public synchronized void setPointStyle(String objName, int style) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return; } if (geo instanceof PointProperties) { ((PointProperties) geo).setPointStyle(style); geo.updateRepaint(); } }
/** * Deletes the object with the given name. */ @Override public synchronized void deleteObject(String objName) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return; } geo.remove(); kernel.notifyRepaint(); }
@Override public synchronized void setCaption(String objName, String caption) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null) { return; } geo.setCaption(caption); geo.updateRepaint(); }
private static void putCell(GeoElement cell, int column, int row) { String label = GeoElementSpreadsheet.getSpreadsheetCellName(column, row); GeoElement old = cell.getKernel().lookupLabel(label); if (old != null) { old.remove(); } cell.setLabel(label); }
@Override public synchronized void setTextValue(String objName, String x) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null || !geo.isGeoText() || !geo.isIndependent()) { return; } ((GeoText) geo).setTextString(x); geo.updateRepaint(); }
@Override public synchronized void setListValue(String objName, double x, double y) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null || !geo.isGeoList() || !geo.isIndependent()) { return; } Construction cons = kernel.getConstruction(); CmdSetValue.setValue3(kernel, (GeoList) geo, (int) x, new GeoNumeric(cons, y)); }