Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.Location


        _leds = new RectangleAttribute[rowsValue][columnsValue];
        for (int x = 0; x < rowsValue; x++) {
            for (int y = 0; y < columnsValue; y++) {
                RectangleAttribute rectangle = new RectangleAttribute(
                        _ledArray_icon, "_led_" + x + "_" + y);
                Location location = new Location(rectangle, "_location");
                double[] ledLocationValue = { x * 20, y * 20 };
                location.setLocation(ledLocationValue);
                rectangle.width.setToken("20.0");
                rectangle.height.setToken("39.0");
                rectangle.centered.setToken("true");
                rectangle.fillColor.setToken("{0.0, 0.0, 0.0, 1.0}");
                _leds[x][y] = rectangle;
View Full Code Here


        deAnnotateGraph();

        Iterator nodes = _graphModel.nodes(_model);

        while (nodes.hasNext()) {
            Location node = (Location) nodes.next();
            NamedObj entity = (NamedObj) _graphModel.getSemanticObject(node);

            if (_entities.contains(entity)) {
                Figure figure = _controller.getFigure(node);
                _selectionModel.addSelection(figure);
View Full Code Here

        StringAttribute controlCardinal = new StringAttribute(enable,
                "_cardinal");
        controlCardinal.setExpression("SOUTH");

        Location location = new Location(enable, "_location");
        location.setExpression("[140.0, 35.0]");

        // Create an inside director.
        SRDirector director = new SRDirector(this, "SRDirector");
        location = new Location(director, "_location");
        location.setExpression("[65.0, 35.0]");
    }
View Full Code Here

     @param destination The destination port.
     *  @param lineName The name of the line attribute to create.
     */
    protected void _drawLine(WirelessIOPort sender, WirelessIOPort destination,
            final String lineName) {
        Location senderLocation = (Location) sender.getContainer()
                .getAttribute("_location");
        Location destinationLocation = (Location) destination.getContainer()
                .getAttribute("_location");
        double x = (destinationLocation.getLocation())[0]
                - (senderLocation.getLocation())[0];
        double y = (destinationLocation.getLocation())[1]
                - (senderLocation.getLocation())[1];
        String moml = "<property name=\""
                + lineName
                + "\" class=\"ptolemy.vergil.kernel.attributes.LineAttribute\">"
                + senderLocation.exportMoML() + "<property name=\"x\" value=\""
View Full Code Here

     @exception IllegalActionException If the location attribute does
     *   not exist or cannot be evaluated.
     */
    protected double[] _getLocation() throws IllegalActionException {
        //Entity container = (Entity)this.getContainer();
        Location locationAttribute = (Location) getAttribute("_location",
                Location.class);

        if (locationAttribute == null) {
            throw new IllegalActionException(this,
                    "Cannot find a _location attribute of class Location.");
        }

        return locationAttribute.getLocation();
    }
View Full Code Here

        _setClassName();

        // Create an inside director.
        PtinyOSDirector director =
            new PtinyOSDirector(this, "PtinyOSDirector");
        Location location = new Location(director, "_location");
        location.setExpression("[65.0, 35.0]");

        // Set the port orientation so that input ports are on top
        // edge of the icon.
        rotatePorts = new Parameter(this, "_rotatePorts", new IntToken(90));
    }
View Full Code Here

        // For each LED, create the corresponding parameter and
        // graphical icon.  Then initialize the LED to the off setting.
        red = new Parameter(this, "red");
        _ledRed = new RectangleAttribute(node_icon, "_ledRed");

        Location ledRedLoc = new Location(_ledRed, "_location");
        double[] ledRedLocVal = { -20.0, 0.0 };
        ledRedLoc.setLocation(ledRedLocVal);
        _ledRed.width.setToken("20.0");
        _ledRed.height.setToken("39.0");
        _ledRed.centered.setToken("true");
        _redOff();

        green = new Parameter(this, "green");
        _ledGreen = new RectangleAttribute(node_icon, "_ledGreen");

        Location ledGreenLoc = new Location(_ledGreen, "_location");
        double[] ledGreenLocVal = { 0.0, 0.0 };
        ledGreenLoc.setLocation(ledGreenLocVal);
        _ledGreen.width.setToken("20.0");
        _ledGreen.height.setToken("39.0");
        _ledGreen.centered.setToken("true");
        _greenOff();

        yellow = new Parameter(this, "yellow");
        _ledYellow = new RectangleAttribute(node_icon, "_ledYellow");

        Location ledYellowLoc = new Location(_ledYellow, "_location");
        double[] ledYellowLocVal = { 20.0, 0.0 };
        ledYellowLoc.setLocation(ledYellowLocVal);
        _ledYellow.width.setToken("20.0");
        _ledYellow.height.setToken("39.0");
        _ledYellow.centered.setToken("true");
        _yellowOff();
View Full Code Here

     @return An array identifying the location.
     *  @exception IllegalActionException If the location attribute does
     *   not exist or cannot be evaluated.
     */
    protected double[] _getLocation() throws IllegalActionException {
        Location locationAttribute = (Location) getAttribute("_location",
                Location.class);

        if (locationAttribute == null) {
            throw new IllegalActionException(this,
                    "Cannot find a _location attribute of class Location.");
        }

        return locationAttribute.getLocation();
    }
View Full Code Here

     *  port.
     */
    public void fire() throws IllegalActionException {
        //super.fire();
        Entity container = (Entity) this.getContainer();
        Location locationAttribute = (Location) container.getAttribute(
                "_location", Location.class);

        if (locationAttribute == null) {
            throw new IllegalActionException(this,
                    "Cannot find a _location attribute of class Location.");
        }

        _myLocation = locationAttribute.getLocation();

        if (trigger.hasToken(0)) {
            //System.out.println("receiving an trigger and firing the persure.");
            trigger.get(0);
            xlocation.send(0, new DoubleToken(_myLocation[0] + _speed[0]));
View Full Code Here

     */
    public void initialize() throws IllegalActionException {
        super.initialize();

        Entity container = (Entity) this.getContainer();
        Location locationAttribute = (Location) container.getAttribute(
                "_location", Location.class);

        if (locationAttribute == null) {
            throw new IllegalActionException(this,
                    "Cannot find a _location attribute of class Location.");
        }

        _myLocation = locationAttribute.getLocation();
        _getWorkRange();
        _parentLocation = _myLocation;
        _parentDepth = 0;
        _timeValue = 0.0;
        _speed = new double[2];
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.Location

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.