/** * @param isAngle * whether to return angle * @return construction default for number or angle */ public GeoNumeric getDefaultNumber(boolean isAngle) { return (GeoNumeric) cons.getConstructionDefaults() .getDefaultGeo(isAngle ? ConstructionDefaults.DEFAULT_ANGLE : ConstructionDefaults.DEFAULT_NUMBER); }
private int countSliders() { int count = 0; // get all number and angle sliders TreeSet<GeoElement> numbers = cons .getGeoSetLabelOrder(GeoClass.NUMERIC); TreeSet<GeoElement> angles = cons.getGeoSetLabelOrder(GeoClass.ANGLE); numbers.addAll(angles); Iterator<GeoElement> it = numbers.iterator(); while (it.hasNext()) { GeoNumeric num = (GeoNumeric) it.next(); if (num.isSlider()) { count++; } } return count; }
/** * Store both global and mode specific undo point. */ public void storeUndoInfoAndStateForModeStarting() { if (cons != null) { storeStateForModeStarting(); if (cons.isUndoEnabled()) { // reuse cons.getCurrentUndoXML(true) cons.getUndoManager().storeUndoInfo(stateForModeStarting, false); } } }
/** * @param random * true for random slider */ public void setRandom(boolean random) { randomSlider = random; if (random) { cons.addRandomGeo(this); } else { cons.removeRandomGeo(this); } }
/** * Processes XML * * @param strXML * XML string * @param isGGTOrDefaults * whether to treat the XML as defaults * @param info * EvalInfo (can be null) * @throws Exception * on trouble with parsing or running commands */ final public synchronized void processXML(String strXML, boolean isGGTOrDefaults, EvalInfo info) throws Exception { boolean randomize = info == null || info.updateRandom(); construction.setFileLoading(true); construction.setCasCellUpdate(true); construction.getXMLio().processXMLString(strXML, true, isGGTOrDefaults, true, randomize); construction.setFileLoading(false); construction.setCasCellUpdate(false); }
boolean oldLabelCreationFlag = cons.isSuppressLabelsActive(); cons.setSuppressLabelCreation(true); if (point.getColorFunction() == null) { setDefaultColor = point.getObjectColor() .equals(cons.getConstructionDefaults() .getDefaultGeo( ConstructionDefaults.DEFAULT_POINT_FREE) true); cons.setSuppressLabelCreation(oldLabelCreationFlag); cons.replace((GeoElement) point, (GeoElement) newPoint, null); newPoint.setObjColor(cons.getConstructionDefaults() .getDefaultGeo( ConstructionDefaults.DEFAULT_POINT_IN_REGION)
consDefaults = parentConstruction.getConstructionDefaults(); } else { newConstructionDefaults(); setIgnoringNewTypes(true); initAxis(); setIgnoringNewTypes(false); geoTable = new HashMap<>(200); initGeoTables();
public void storeUndoInfo() { if (app != null) { app.getKernel().getConstruction().getUndoManager() .storeUndoInfo(false); } } }
cmdCons.addLocalVariable(localVarName, num); replaceZvarIfNeeded(localVarName, c, varPos); boolean oldval = cons.isSuppressLabelsActive(); cons.setSuppressLabelCreation(true); NumberValue initValue; try { new EvalInfo(false))[0]; } catch (MyError e) { cmdCons.removeLocalVariable(localVarName); throw e; cons.setSuppressLabelCreation(oldval); num.setValue(initValue.getDouble()); } finally { cmdCons.removeLocalVariable(localVarName);
TreeSet<GeoElement> geoSet = cons.getGeoSetConstructionOrder(); this.sphereND.setObjColor(cons.getConstructionDefaults().getNextColor());
copiedXMLlabelsforSameWindow = new ArrayList<>(); copySource = app.getActiveEuclidianView(); copyObject = app.getKernel().getConstruction().getUndoManager() .getCurrentUndoInfo(); copiedMacros = new HashSet<>(); for (int i = 0; i < cons.steps(); ++i) { ce = cons.getConstructionElement(i); if (geoslocal.contains(ce)) { ce.getXML(false, copiedXML); for (int i = 0; i < cons.steps(); ++i) { ce = cons.getConstructionElement(i); if (geoslocalsw.contains(ce)) { ce.getXML(false, copiedXMLforSameWindow);
/** * @param c * construction */ public AlgoUsingTempCASalgo(Construction c) { super(c); c.addCASAlgo(this); }
/** * @param xml * XML string * @param clearConstruction * true to clear construction before processing * @param isGgtFile * true for macro files * @param randomize * whether to randomize numbers * @throws Exception * if XML is invalid or there was a problem while processing */ public void processXMLString(String xml, boolean clearConstruction, boolean isGgtFile, boolean randomize) throws Exception { if (cons != null) { cons.setFileLoading(true); } if (!isGgtFile) { app.resetUniqueId(); } processXMLString(xml, clearConstruction, isGgtFile, true, randomize); if (cons != null) { cons.setFileLoading(false); } }
/** * Redo last action. */ public void redo() { if (undoActive && cons.getUndoManager().redoPossible()) { app.batchUpdateStart(); resetBeforeReload(); cons.redo(); restoreAfterReload(); app.batchUpdateEnd(); storeStateForModeStarting(); app.getEventDispatcher() .dispatchEvent(new Event(EventType.REDO, null)); app.setUnAutoSaved(); } }
/** * TODO add support for layer / object type sorting of AV * * @return set over which TAB iterates: either alphabetical or construction * order */ public TreeSet<GeoElement> getTabbingSet() { if (this.kernel.getApplication().getGuiManager() != null && this.kernel .getApplication().getGuiManager().hasAlgebraViewShowing()) { if (this.kernel.getApplication().getSettings().getAlgebra() .getTreeMode() == SortMode.ORDER) { return kernel.getConstruction().getGeoSetConstructionOrder(); } } return kernel.getConstruction().getGeoSetLabelOrder(); }
/** * @param cons * construction * @param label * output label * @param a * lower bound for the distribution * @param b * upper bound for the distribution */ public AlgoRandomUniform(Construction cons, String label, GeoNumberValue a, GeoNumberValue b) { super(cons, label, a, b); // output is random number cons.addRandomGeo(num); }
tb = new GeoNumeric(cons); tc = new GeoNumeric(cons); cons.addLocalVariable("A", ta); cons.addLocalVariable("B", tb); cons.addLocalVariable("C", tc); if (!(c.getArgument(3).unwrap() instanceof Equation)) { clearLocal(); boolean oldMacroMode = cons.isSuppressLabelsActive(); cons.setSuppressLabelCreation(true); arg[3] = kernel.getAlgebraProcessor().processEquation( (Equation) c.getArgument(3).unwrap(), c.getArgument(3), true, new EvalInfo(false))[0]; cons.setSuppressLabelCreation(oldMacroMode); if ((ok[0] = arg[0] instanceof GeoPoint) && (ok[1] = arg[1] instanceof GeoPoint)
if (cons.getUndoManager().undoPossible()) { app.batchUpdateStart(); resetBeforeReload(); cons.undo(); restoreAfterReload();
copyObject2 = app.getKernel().getConstruction().getUndoManager() .getCurrentUndoInfo(); EuclidianViewInterfaceCommon ev = app.getActiveEuclidianView(); app.getGgbApi().evalXML(copiedXMLforSameWindow.toString()); app.getKernel().getConstruction().updateConstruction(false); if (ev == app.getEuclidianView1()) { app.setActiveView(App.VIEW_EUCLIDIAN); app.getKernel().getConstruction().updateConstruction(false); if (ev == app.getEuclidianView1()) { app.setActiveView(App.VIEW_EUCLIDIAN);
/** * Initialize undo manager if possible. */ public void initUndoInfo() { if (undoActive && cons != null) { cons.initUndoInfo(); } }