public JPanel update(Object[] geos) { this.geos = geos; if (!checkGeos(geos)) return null; tfAnimStep.removeActionListener(this); // check if properties have same values GeoElement temp, geo0 = (GeoElement) geos[0]; boolean equalStep = true; boolean onlyAngles = true; for (int i = 0; i < geos.length; i++) { temp = (GeoElement) geos[i]; // same object visible value if (!Kernel.isEqual(geo0.getAnimationStep(), temp.getAnimationStep())) equalStep = false; if (!(temp.isGeoAngle())) onlyAngles = false; } // set trace visible checkbox // int oldDigits = kernel.getMaximumFractionDigits(); // kernel.setMaximumFractionDigits(PropertiesDialog.TEXT_FIELD_FRACTION_DIGITS); StringTemplate highPrecision = StringTemplate.printDecimals( StringType.GEOGEBRA, PropertiesDialog.TEXT_FIELD_FRACTION_DIGITS, false); if (equalStep) { GeoElement stepGeo = geo0.getAnimationStepObject(); if (onlyAngles && (stepGeo == null || (!stepGeo.isLabelSet() && stepGeo.isIndependent()))) tfAnimStep.setText(kernel.formatAngle(geo0.getAnimationStep(), highPrecision).toString()); else tfAnimStep.setText(stepGeo.getLabel(highPrecision)); } else tfAnimStep.setText(""); tfAnimStep.addActionListener(this); return this; }
private void init() { // copy the construction Qin = locusPoint.getAllPredecessors(); // all parents of Q // get intersection of all children of P and all parents of Q locusConsOrigElements = new TreeSet<ConstructionElement>(); TreeSet<Long> usedAlgoIds = new TreeSet<Long>(); Iterator<GeoElement> it = Qin.iterator(); while (it.hasNext()) { GeoElement parent = it.next(); if (parent.isLabelSet() && parent.isChildOf(movingPoint)) { // note: locusConsOrigElements will contain AlgoElement and GeoElement objects Macro.addDependentElement(parent, locusConsOrigElements, usedAlgoIds); } } // ensure that P and Q have labels set // Note: we have to undo this at the end of this method !!! boolean isLabeledP = movingPoint.isLabelSet(); if (!isLabeledP) { movingPoint.label = movingPoint.getDefaultLabel(); movingPoint.labelSet = true; } boolean isLabeledQ = locusPoint.isLabelSet(); if (!isLabeledQ) { locusPoint.label = locusPoint.getDefaultLabel(); locusPoint.labelSet = true; } // add moving point on line locusConsOrigElements.add(movingPoint); // add locus creating point and its algorithm to locusConsOrigElements Macro.addDependentElement(locusPoint, locusConsOrigElements, usedAlgoIds); // create macro construction buildLocusMacroConstruction(locusConsOrigElements); // if we used temp labels remove them again if (!isLabeledP) movingPoint.labelSet = false; if (!isLabeledQ) locusPoint.labelSet = false; }