Package es.iiia.shapegrammar.shape

Examples of es.iiia.shapegrammar.shape.ShapeModel


  // we need to check if this transformation of given shape has executed the
  // rule
  public boolean executeNext(IProgressMonitor monitor) {
    // in the basket always first is our main shape
   
    ShapeModel shape = super.getShapeBasket().get(0).clone();
    shape.moveToCenter();
    shape.maximize();

    // get next state
    StateExecution state = this.getNext(monitor, shape);

    if (state == null) {
      monitor.done();
      return false;
    }
   
    // we test if the shape has changed
    // TODO: this will not work for replace   
    ShapeModel newShape = this.execute(shape, state, true);   
    if (newShape == null) {
      Debugger.getInstance().addMessage("Restarting process, no change in shape!");
      return this.executeNext(monitor);
    }
    Debugger.getInstance().addMessage("EXECUTED: " + state.toString());
View Full Code Here


    Debugger.getInstance().addMessage("EXECUTED Sh: " + state.getShape().toString());
    Debugger.getInstance().addMessage("EXECUTED Tr: " + state.toString());
   
    // execute current rule
    ShapeModel newShape = state.getRule().execute(state, close);
    shape.merge(newShape);
    shape.maximize();
   
    Debugger.getInstance().addMessage(pointCount + ":" + shape.getPoints().size() + " " + lineCount + ":" + shape.getLines().size());   
   
View Full Code Here

            .size() == 0) {
          Debugger.getInstance().addMessage("No rules for: " + grammarShape.getName());
          continue;
        }
 
        ShapeModel clone = grammarShape.clone();
        clone.moveToCenter();
 
        // TODO: Allow to stop even in subshape detection
        try {
          ExecutionReport.startShape(grammarShape.getName());
          subShapes = ShapeTools.findSubShape(
View Full Code Here

        this.setPropagateTransform(false);
    }

    // abstract method which for each different rule creates different results
    public ShapeModel execute(StateExecution state, boolean close) {
        ShapeModel returnShape = this.getRightShape().getCenteredShape();
        state.getAffineTransform().concatenate(this.getTransform());
        if (close) {
          state.setExecuted(true);
        }
        returnShape.transform(state.getAffineTransform());
        return returnShape;
    }
View Full Code Here

  private void createForeignModel() {
    foreignModel = new GeneralPath();
   
    if (model.getLeftShape() != null && model.getRightShape() != null) {
      // create right side of the rule
      ShapeModel lsh = model.getLeftShape().getCenteredShape();
      ShapeController lctr = new ShapeController(lsh);
     
      ShapeModel rsh = model.getRightShape().getCenteredShape();
      rsh.transform(model.getTransform());
      ShapeController rctr = new ShapeController(rsh);
     
      if (!(model instanceof RuleSubstitution)) {
        lctr.append(foreignModel);
      }
View Full Code Here

  public ShapeModel getTransformedShape() {
    return this.getTransformedShape(true);
  }
 
  private ShapeModel getTransformedShape(boolean moveToScreenCenter) {
    ShapeModel model = this.getCenteredShape();

    // transform based on stored transformation
    model.transform(this.transform.getTransform());

    //System.out.println("RuleShapeModel(45): " + this.transform.getTransform());

    // center model
//    if (moveToScreenCenter) {
View Full Code Here

   
    return model;
  }
 
  public ShapeModel getCenteredTransformedShape() {
    ShapeModel model = this.getCenteredShape();

    // transform based on stored transformation
    model.transform(this.transform.getTransform());
    return model;
  }
View Full Code Here

    model.transform(this.transform.getTransform());
    return model;
  }

  public ShapeModel getCenteredShape() {
    ShapeModel clonedShape = this.shape.clone();

    // center the shape, send it to [0,0]
    clonedShape.moveToCenter();

    return clonedShape;
  }
View Full Code Here

        transform);
  }
 
  private AffineTransform createTransform(AffineTransform transform) {
    // find center of current shape
    ShapeModel transfShape = this.getTransformedShape(false);
    double centerX = transfShape.getBounds().getCenterX();
    double centerY = transfShape.getBounds().getCenterY();
   
    //System.out.println("Center: " + centerX + "," + centerY);
   
    // now recreate this transform
   
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 center fo the window
//        IFigure part = ((RuleEditPart)editor.getGraphicalViewer().getContents()).getFigure();
//       
//        rule.setCenter(new PointModel(part.getBounds().getCenter().x, part.getBounds().getCenter().y));
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.