/** * Remove the child shape with index idx. */ public void removeChild(int idx) { if (idx < childCount) { PShape child = children[idx]; // Copy [idx + 1, childCount - 1] to [idx, childCount - 2] for (int i = idx; i < childCount - 1; i++) { children[i] = children[i + 1]; } childCount--; if (child.getName() != null && nameTable != null) { nameTable.remove(child.getName()); } } }
/** * Remove the child shape with index idx. */ public void removeChild(int idx) { if (idx < childCount) { PShape child = children[idx]; // Copy [idx + 1, childCount - 1] to [idx, childCount - 2] for (int i = idx; i < childCount - 1; i++) { children[i] = children[i + 1]; } childCount--; if (child.getName() != null && nameTable != null) { nameTable.remove(child.getName()); } } }
/** * @param idx the layer position in which to insert the new child */ public void addChild(PShape who, int idx) { if (idx < childCount) { if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } // Copy [idx, childCount - 1] to [idx + 1, childCount] for (int i = childCount - 1; i >= idx; i--) { children[i + 1] = children[i]; } childCount++; children[idx] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } } }
/** * @webref pshape:method * @brief Adds a new child * @param who any variable of type PShape * @see PShape#getChild(int) */ public void addChild(PShape who) { if (children == null) { children = new PShape[1]; } if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } children[childCount++] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } }
/** * @webref pshape:method * @brief Adds a new child * @param who any variable of type PShape * @see PShape#getChild(int) */ public void addChild(PShape who) { if (children == null) { children = new PShape[1]; } if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } children[childCount++] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } }
/** * @param idx the layer position in which to insert the new child */ public void addChild(PShape who, int idx) { if (idx < childCount) { if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } // Copy [idx, childCount - 1] to [idx + 1, childCount] for (int i = childCount - 1; i >= idx; i--) { children[i + 1] = children[i]; } childCount++; children[idx] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } } }
public MarkerList getList() { PShape svg = new PShapeSVGExtended(xml); ArrayList<PShape> markersSVG = new ArrayList<>(); findMarkers((PShapeSVGExtended) svg, markersSVG); MarkerList markers = new MarkerList(); markers.setSheetSize(sheetWidthMm, sheetHeightMm); for (PShape markerSvg : markersSVG) { int id = Integer.parseInt(markerSvg.getName().substring(6)); MarkerSvg marker = createMarker(markerSvg, id); markers.put(id, marker); } return markers; }
public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) { PShapeOpenGL dest = null; if (src.getFamily() == GROUP) { //dest = PGraphics3D.createShapeImpl(pg, GROUP); dest = (PShapeOpenGL) pg.createShapeFamily(GROUP); copyGroup(pg, src, dest); } else if (src.getFamily() == PRIMITIVE) { //dest = PGraphics3D.createShapeImpl(pg, src.getKind(), src.getParams()); dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams()); PShape.copyPrimitive(src, dest); } else if (src.getFamily() == GEOMETRY) { //dest = PGraphics3D.createShapeImpl(pg, PShape.GEOMETRY); dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY); PShape.copyGeometry(src, dest); } else if (src.getFamily() == PATH) { dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH); //dest = PGraphics3D.createShapeImpl(pg, PATH); PShape.copyPath(src, dest); } dest.setName(src.getName()); dest.width = src.width; dest.height = src.height; dest.depth = src.depth; return dest; }
public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) { PShapeOpenGL dest = null; if (src.getFamily() == GROUP) { //dest = PGraphics3D.createShapeImpl(pg, GROUP); dest = (PShapeOpenGL) pg.createShapeFamily(GROUP); copyGroup(pg, src, dest); } else if (src.getFamily() == PRIMITIVE) { //dest = PGraphics3D.createShapeImpl(pg, src.getKind(), src.getParams()); dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams()); PShape.copyPrimitive(src, dest); } else if (src.getFamily() == GEOMETRY) { //dest = PGraphics3D.createShapeImpl(pg, PShape.GEOMETRY); dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY); PShape.copyGeometry(src, dest); } else if (src.getFamily() == PATH) { dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH); //dest = PGraphics3D.createShapeImpl(pg, PATH); PShape.copyPath(src, dest); } dest.setName(src.getName()); dest.width = src.width; dest.height = src.height; dest.depth = src.depth; return dest; }