Package es.iiia.shapegrammar.shape

Examples of es.iiia.shapegrammar.shape.ShapeModel


      if (selection != null && selection instanceof IStructuredSelection) {
        Object obj = ((IStructuredSelection) selection)
            .getFirstElement();
        // If we had a selection lets open the editor
        if (obj != null) {
          ShapeModel shape = (ShapeModel) obj;
          ShapeGrammarModel grammar = (ShapeGrammarModel) shape
              .getParent();
          grammar.deleteShape(shape);
         
          // now close the editor holding this rule
          for (IEditorReference editor : window.getActivePage()
View Full Code Here


        .getSelectionProvider().getSelection();
    if (selection != null && selection instanceof IStructuredSelection) {
      Object obj = ((IStructuredSelection) selection).getFirstElement();
      // If we had a selection lets open the editor
      if (obj != null) {
        ShapeModel shape = (ShapeModel) obj;

        ShapeGrammarModel.ACTIVE_SHAPE_GRAMMAR.setStartShape(shape);
      }
    }
    return null;
View Full Code Here

    // Get Shape View window
    ShapeView shapes = (ShapeView) workbenchWindow.getActivePage()
        .findView(ShapeView.ID);

    // Create instance of the new shape
    ShapeModel shape = this.createShape(shapes);

    // now open editor
    ShapeGrammarInput input = new ShapeGrammarInput(shape);
    try {
      // opens editor
      ShapeEditor editor = (ShapeEditor) workbenchWindow.getActivePage()
          .openEditor(
              input,
              shape.getEditorId() == null ? ShapeEditor.ID
                  : shape.getEditorId());

      // hook the listener
      shape.addPropertyChangeListener(editor);

      // shows properties
      workbenchWindow.getActivePage().showView(IPageLayout.ID_PROP_SHEET);

    } catch (PartInitException e) {
View Full Code Here

        .getSelectionProvider().getSelection();
    if (selection != null && selection instanceof IStructuredSelection) {
      Object obj = ((IStructuredSelection) selection).getFirstElement();
      // If we had a selection lets open the editor
      if (obj != null) {
        ShapeModel shape = (ShapeModel) obj;
       
        // find the window centre
//        IFigure part = ((RuleEditPart)editor.getGraphicalViewer().getContents()).getFigure();
//        rule.setCenter(new PointModel(part.getBounds().getCenter().x, part.getBounds().getCenter().y));
        rule.setRightShape(shape);
View Full Code Here

        // get the resize ratio
        double resize = (iconSize - 8)
            / (bounds.getWidth() > bounds.getHeight() ? bounds
                .getWidth() : bounds.getHeight());
        // resize graphics
        ShapeModel newShape = shape.clone();
        newShape.moveToCenter();
        newShape.scale(resize, resize);
        // now move it to centre of the icon
        newShape.translate(iconSize / 2, iconSize  / 2);
               
       
        for (LineModel line : newShape.getLines()) {
          for (int i=0; i<line.getPoints().size()-1; i++) {
            drawLine(e.gc, line.getPoints().get(i), line.getPoints().get(i+1));
          }
          if (line.isClosed()) {
            drawLine(e.gc, line.getPoints().get(0), line.getPoints().get(line.getPoints().size()-1));
View Full Code Here

       
        setPartName("Render");

    // We keep
    shapeGrammar = (ShapeGrammarModel) ((ShapeGrammarInput) input).getNode();
    model = new ShapeModel(ShapeGrammarModel.ACTIVE_SHAPE_GRAMMAR);
   
    // init protocol
    protocol = new BreadthFirstProtocol(shapeGrammar, 1)
  }
View Full Code Here

 
  public void exportFigure(String fileName) {
    ShapeGrammarModel grammar = new ShapeGrammarModel();
    grammar.getShapes().clear();

    ShapeModel wholeModel = grammar.addShape();   
    wholeModel.merge((ShapeModel) model);
   
    Rectangle2D modelBounds = wholeModel.getBounds();
   
    // now move to 0,0
    if (modelBounds.getMinX() < 0) {
      wholeModel.translate(-modelBounds.getMinX(), 0);
    }
    if (modelBounds.getMinY() < 0) {
      wholeModel.translate(0, -modelBounds.getMinY());
    }
   
    grammar.setCurrentFileName(fileName);
    grammar.save();
  }
View Full Code Here

            Debugger.getInstance().addMessage("No possible step found!");
            return false;
        }

        // execute current rule
        ShapeModel currentShape = state.getRule().execute(state);
        this.getShapeBasket().add(currentShape);
       
        state.setExecuted(true);

        // this is the code for finding symmetries in object
View Full Code Here

  // operations
 
  public ShapeModel addShape() {
    // create new shape
    ShapeModel model = ShapeGrammarModel.ACTIVE_SHAPE_GRAMMAR.addShape();   
   
    // add new listener
    model.addPropertyChangeListener(this);
   
    return model;
  }
View Full Code Here

      for (int i = 0; i < nl.getLength(); i++) {
        // get the shape element
        Element el = (Element) nl.item(i);

        // initialize it and add it to collection
        ShapeModel model = initShape(el);
       
        this.grammar.getShapes().add(model);
      }
    }
View Full Code Here

TOP

Related Classes of es.iiia.shapegrammar.shape.ShapeModel

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.