public void save(PrintWriter printWriter) { printWriter.println(pose.getX() + " " + pose.getY() + " " + width + " " + height + " " + getType() + " " + id); }
public static ShapeArtifact load(BufferedReader bufferedReader) { ShapeArtifact shapeArtifact = null; try { String line = bufferedReader.readLine(); if (line == null) return null; StringTokenizer s = new StringTokenizer(line, " "); double x = Double.parseDouble(s.nextToken()); double y = Double.parseDouble(s.nextToken()); Point2D pose = new Point2D(x, y); double width = Double.parseDouble(s.nextToken()); double height = Double.parseDouble(s.nextToken()); String type = s.nextToken(); String id = s.nextToken(); shapeArtifact = new ShapeArtifact(id, type, height, width, pose); } catch (Exception e) { e.printStackTrace(); } return shapeArtifact; }
public void save(PrintWriter printWriter) { printWriter.println(pose.getX() + " " + pose.getY() + " " + width + " " + height + " " + getType() + " " + id); }
public static ShapeArtifact load(BufferedReader bufferedReader) { ShapeArtifact shapeArtifact = null; try { String line = bufferedReader.readLine(); if (line == null) return null; StringTokenizer s = new StringTokenizer(line, " "); double x = Double.parseDouble(s.nextToken()); double y = Double.parseDouble(s.nextToken()); Point2d pose = new Point2d(x, y); double width = Double.parseDouble(s.nextToken()); double height = Double.parseDouble(s.nextToken()); String type = s.nextToken(); String id = s.nextToken(); shapeArtifact = new ShapeArtifact(id, type, height, width, pose); } catch (Exception e) { e.printStackTrace(); } return shapeArtifact; }
@Override public void drawLegend(Plotter2DAdapter graphics, Point2D origin) { graphics.setColor(color); tempCenter.set(origin); tempRadii.set(LEGEND_RADIUS, LEGEND_RADIUS); if (getType().equals("fillcircle")) { graphics.drawOvalFilled(graphics.getScreenFrame(), tempCenter, tempRadii); } else if (getType().equals("circle")) { graphics.drawOval(graphics.getScreenFrame(), tempCenter, tempRadii); } else if (getType().equals("fillrectangle")) { graphics.drawSquareFilled(graphics.getScreenFrame(), tempCenter, tempRadii); } else if (getType().equals("rectangle")) { graphics.drawRectangle(graphics.getScreenFrame(), tempCenter, tempRadii); } }
@Override public void drawLegend(Plotter2DAdapter graphics, Point2d origin) { graphics.setColor(color); tempCenter.set(origin); tempRadii.set(LEGEND_RADIUS, LEGEND_RADIUS); if (getType().equals("fillcircle")) { graphics.drawOvalFilled(graphics.getScreenFrame(), tempCenter, tempRadii); } else if (getType().equals("circle")) { graphics.drawOval(graphics.getScreenFrame(), tempCenter, tempRadii); } else if (getType().equals("fillrectangle")) { graphics.drawSquareFilled(graphics.getScreenFrame(), tempCenter, tempRadii); } else if (getType().equals("rectangle")) { graphics.drawRectangle(graphics.getScreenFrame(), tempCenter, tempRadii); } }