Package simtools.shapes

Examples of simtools.shapes.AbstractShape


  /* (non-Javadoc)
   * @see jsynoptic.base.Plugin#createShape(java.lang.String)
   */
  public AbstractShape createShape(String name) {
      AbstractShape res = null;
     
    if (name.equals(PLOT_STANDARD)) {
      SourceXYDataset dst = new SourceXYDataset();
      JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dst, true, true, false);
      chart.setAntiAlias(AbstractShape.ANTI_ALIASING);
View Full Code Here


   
    /* (non-Javadoc)
     * @see jsynoptic.base.Plugin#createShape(java.lang.String)
     */
    public AbstractShape createShape(String name) {
        AbstractShape res = null;
       
        if ((name.equals(PLOT)) || (name.equals(TIME_PLOT))) {
            Plot plot = null;
            if (name.equals(PLOT)) {
                plot = new Plot(0, 0, resources.getIntValue("defaultPlotWidth"), resources
View Full Code Here

   
    /* (non-Javadoc)
     * @see jsynoptic.base.Plugin#createShape(java.lang.String, int, int, int, int)
     */
    public AbstractShape createShape(String name, int x, int y, int width, int height) {
        AbstractShape res = null;

        if (name.equals(TEXT)) {
            // Do not fit text bounds if a width and a height is specified
            res =  new TextShape(resources.getString("Text"), x, y, width, height, false);
     
View Full Code Here

                }
                is.close();
                fis.close(); // also closes the file
                for (Iterator it = sc.iterator(); it.hasNext();) {
                    try {
                        AbstractShape abs = (AbstractShape) it.next();
                        abs.addListener( (ShapeListener)sc.getComponent());
                        if (!(abs instanceof Linkable)) {
                            continue;
                        }
                        Linkable l = (Linkable) abs;
                        // Now trying to restore absolute file
View Full Code Here

        }
        sc.getComponent().setName(name);
        // Restoring absolute links
        for (Iterator it = sc.iterator(); it.hasNext();) {
            try {
                AbstractShape abs = (AbstractShape) it.next();
                abs.addListener( (ShapeListener)sc.getComponent());
                if (!(abs instanceof Linkable)) {
                    continue;
                }
                Linkable l = (Linkable) abs;
                // Now trying to restore absolute file
View Full Code Here

   
    // add number tags on image
    for(int i=0;i<sheet.size();i++){
      Object o = sheet.get(i);
      if (o instanceof AbstractShape) {
        AbstractShape shape = (AbstractShape)o;
        g2.setColor(Color.BLACK);
        g2.drawRect(shape.getBounds().x, shape.getBounds().y, CIRCLE_SIZE, CIRCLE_SIZE);
       
        g2.setColor(Color.RED);
        g2.fillRect(shape.getBounds().x, shape.getBounds().y, CIRCLE_SIZE, CIRCLE_SIZE);
        g2.setColor(Color.WHITE);
        new TextLayout(new Integer(i).toString(), g2.getFont(), g2.getFontRenderContext()).draw(g2, shape.getBounds().x+4, shape.getBounds().y+ (CIRCLE_SIZE-4));
      }
    }
   
    ImageIO.write(bi,resources.getString("imageFileExtension"),_imageFile);
    _htmlFile = new File(resources.getString("htmlFileName")).getCanonicalFile();

    FileWriter writeFile= new FileWriter(_htmlFile);
    BufferedWriter writeBuf = new BufferedWriter(writeFile)
    HTMLWriter writer = new HTMLWriter(writeBuf);
    writer.writeHtmlBegin();
    try{
      writer.writeTargetName("IMAGETARGET");
      writer.writeH1(sheetInformationTitle, null);

      // make links with descrition
      String[][] targets = new String[sheet.size()][5];

      for(int i=0;i<sheet.size();i++){
        Object o = sheet.get(i);
        if (o instanceof AbstractShape) {
          AbstractShape shape = (AbstractShape)o;

          // left-x, top-y, right-x, bottom-y
          targets[i][0] = new Integer(shape.getBounds().x).toString();
          targets[i][1] = new Integer(shape.getBounds().y).toString();
          targets[i][2] = new Integer(shape.getBounds().x + CIRCLE_SIZE+4).toString();
          targets[i][3] = new Integer(shape.getBounds().y + CIRCLE_SIZE+4).toString();

          // target name
          targets[i][4] = getShapeId(shape, i);

        }
      }
      // Write image with links
      writer.writeImage(_imageFile.getName(),resources.getString("imageFileTitle"), "IMAGEMAP", targets);
    }catch (IOException e){
      e.printStackTrace();
    }

    // Create sheet information
    for(int i=0;i<sheet.size();i++){
      Object o = sheet.get(i);
      if (o instanceof AbstractShape) {
        AbstractShape shape = (AbstractShape)o;

        // Shape name
        writer.writeTargetName(getShapeId(shape,i));
        writer.writeH2(getShapeId(shape, i),null);

        // Shape properties
        String[] propertiesNames = shape.getPropertyNames();
        ArrayList contents = new ArrayList();
       
        if (propertiesNames!=null){
          for(int j=0;j<propertiesNames.length;j++){
            String[] property = new String[2];
            property[0] = propertiesNames[j];

            Object obj = shape.getPropertyValue(propertiesNames[j]);
            if (obj!=null){
              if (obj instanceof NamedProperties){
                String[] objPropertiesNames = ((NamedProperties)obj).getPropertyNames();
                String objToString="";
                for(int k=0;k<objPropertiesNames.length;k++){
View Full Code Here

        /* (non-Javadoc)
         * @see jsynoptic.ui.ShapeCreator#create()
         */
        @Override
        public AbstractShape create() {
            AbstractShape res=new Java3dShape(0, 0, 250, 250, (Universe)_node.getGraphObject());
            _node.refresh();
            return res;
        }
View Full Code Here

  protected void setShapesProperties(){
      super.setShapesProperties();

      // Repaint plots
      for(int i=0;i<shapes.size(); i++){
          AbstractShape shape = (AbstractShape)shapes.get(i);

          if (shape instanceof Plot){
              ((Plot)shape).repaintDiagram(((Plot)shape).getBounds());
          }
      }
View Full Code Here

TOP

Related Classes of simtools.shapes.AbstractShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.