private void addNewGeoToConstruction() { if (objectType == TYPE_LISTOFPOINTS || objectType == TYPE_POLYLINE) { app.getKernel().getConstruction().addToConstructionList(newGeo.getParentAlgorithm(), true); } newGeo.setEuclidianVisible(true); if (!newGeo.isGeoText()) newGeo.setAuxiliaryObject(false); if (objectType == TYPE_LISTOFPOINTS) { GeoList gl = (GeoList) newGeo; for (int i = 0; i < gl.size(); i++) { gl.get(i).setEuclidianVisible(true); gl.get(i).setAuxiliaryObject(false); } } if (objectType == TYPE_POLYLINE) { GeoPoint[] pts = ((AlgoPolyLine) newGeo.getParentAlgorithm()).getPoints(); for (int i = 0; i < pts.length; i++) { pts[i].setEuclidianVisible(true); pts[i].setAuxiliaryObject(false); } } newGeo.update(); app.storeUndoInfo(); }
private void createNewGeo() { boolean nullGeo = newGeo == null; if (!nullGeo) { if (objectType == TYPE_LISTOFPOINTS) { GeoList gl = (GeoList) newGeo; for (int i = 0; i < gl.size(); i++) gl.get(i).remove(); } if (objectType == TYPE_POLYLINE) { GeoPoint[] pts = ((AlgoPolyLine) newGeo.getParentAlgorithm()).getPoints(); for (int i = 0; i < pts.length; i++) pts[i].remove(); } newGeo.remove(); } int column1 = table.selectedCellRanges.get(0).getMinColumn(); int column2 = table.selectedCellRanges.get(0).getMaxColumn(); int row1 = table.selectedCellRanges.get(0).getMinRow(); int row2 = table.selectedCellRanges.get(0).getMaxRow(); boolean copyByValue = btnValue.isSelected(); boolean scanByColumn = cbScanOrder.getSelectedIndex() == 1; boolean leftToRight = cbLeftRightOrder.getSelectedIndex() == 0; boolean transpose = ckTranspose.isSelected(); boolean doCreateFreePoints = true; boolean doStoreUndo = true; boolean isSorted = false; try { switch (objectType) { case TYPE_LIST: newGeo = cp.createList(selectedCellRanges, scanByColumn, copyByValue); break; case TYPE_LISTOFPOINTS: newGeo = cp.createPointGeoList( selectedCellRanges, copyByValue, leftToRight, isSorted, doStoreUndo, doCreateFreePoints); newGeo.setLabel(null); for (int i = 0; i < ((GeoList) newGeo).size(); i++) { ((GeoList) newGeo).get(i).setAuxiliaryObject(true); ((GeoList) newGeo).get(i).setEuclidianVisible(false); } newGeo.updateRepaint(); break; case TYPE_MATRIX: newGeo = cp.createMatrix(column1, column2, row1, row2, copyByValue, transpose); break; case TYPE_TABLETEXT: newGeo = cp.createTableText(column1, column2, row1, row2, copyByValue, transpose); break; case TYPE_POLYLINE: newGeo = cp.createPolyLine(selectedCellRanges, copyByValue, leftToRight); newGeo.setLabel(null); GeoPoint[] pts = ((AlgoPolyLine) newGeo.getParentAlgorithm()).getPoints(); for (int i = 0; i < pts.length; i++) { pts[i].setAuxiliaryObject(true); pts[i].setEuclidianVisible(false); } newGeo.updateRepaint(); break; } ImageIcon latexIcon = new ImageIcon(); // String latexStr = newGeo.getLaTeXAlgebraDescription(true); String latexStr = newGeo.getFormulaString(StringTemplate.latexTemplate, true); // System.out.println(latexStr); Font latexFont = new Font( app.getPlainFont().getName(), app.getPlainFont().getStyle(), app.getPlainFont().getSize() - 1); if (latexStr != null && newGeo.isLaTeXDrawableGeo()) { app.getDrawEquation() .drawLatexImageIcon(app, latexIcon, latexStr, latexFont, false, Color.black, null); lblPreview.setText(" "); } else { lblPreview.setText(newGeo.getAlgebraDescriptionTextOrHTMLDefault()); } lblPreview.setIcon(latexIcon); if (!nullGeo) { newGeo.setLabel(fldName.getText()); newGeo.setAuxiliaryObject(true); newGeo.setEuclidianVisible(false); } updateGUI(); } catch (Exception e) { e.printStackTrace(); } }