Package it.freedomotic.model.object

Examples of it.freedomotic.model.object.Representation


    }

    public void evaluateGate() {
        //checks the intersection with the first view in the list
        //others views are ignored!!!
        Representation representation = getPojo().getRepresentations().get(0);
        FreedomPolygon pojoShape = (FreedomPolygon) representation.getShape();
        int xoffset = representation.getOffset().getX();
        int yoffset = representation.getOffset().getY();
//        double rotation = Math.toRadians(representation.getRotation());
        from = null;
        to = null;

        //now apply offset and rotation to gate the shape
//        AffineTransform transform = new AffineTransform();
//        transform.translate(xoffset, yoffset);
//        transform.rotate(rotation);
//        Shape gateShape = transform.createTransformedShape(TopologyUtils.convertToAWT(pojoShape));
//
//        for (Room room : Freedomotic.environment.getRooms()) {
//            Shape roomPolygon = TopologyUtils.convertToAWT(room.getPojo().getShape());
//            if (roomPolygon.intersects(gateShape.getBounds2D())) {
//                if (from == null) {
//                    from = (Room) room;
//                    to = (Room) room;
//                } else {
//                    to = (Room) room;
//                }
//            }
//        }
        FreedomPolygon objShape =
                TopologyUtils.rotate(TopologyUtils.translate(pojoShape, xoffset, yoffset),
                (int) representation.getRotation());
        EnvironmentLogic env = EnvironmentPersistence.getEnvByUUID(getPojo().getEnvironmentID());

        if (env != null) {
            for (Room room : env.getRooms()) {
                if (TopologyUtils.intersects(objShape,
View Full Code Here


        saveRepresentationChanges();
    }//GEN-LAST:event_spnXStateChanged

    private void spnScaleWidthStateChanged(javax.swing.event.ChangeEvent evt)    {//GEN-FIRST:event_spnScaleWidthStateChanged

        Representation rep = object.getPojo().getCurrentRepresentation();
//        Shape shape = AWTConverter.convertToAWT(rep.getShape(), 1.5, 1.5);
//                new Double(spnScaleWidth.getValue().toString()).doubleValue(),
//                new Double(spnScaleHeight.getValue().toString()).doubleValue());
        rep.setScaleX(new Double(spnScaleWidth.getValue().toString()).doubleValue());

        //rep.setScaleX(new Double(spnScaleWidth.getValue().toString()).doubleValue());
        //object.setChanged(true);
    }//GEN-LAST:event_spnScaleWidthStateChanged
View Full Code Here

        }
    }

    private void changeCurrentRepresentation() {
        try {
            Representation b = object.getPojo().getCurrentRepresentation();
            int x = (Integer) spnX.getValue();
            int y = (Integer) spnY.getValue();
            int rotation = (Integer) spnRotation.getValue();
            b.setOffset(x, y);
            b.setRotation(rotation);

            //object.setChanged(true);
        } catch (NumberFormatException numberFormatException) {
        }
    }
View Full Code Here

TOP

Related Classes of it.freedomotic.model.object.Representation

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.