Prevent scaling of leaf nodes

I am trying to implement a simple map solution in JavaFX 2.0. I have map object in a given resolution and some "car" objects (for example Rectangle) that I would like to overlay the map.
My intention is to create a Group node containing the map objects and the "car" objects. This way I would be able to pan / zoom by only changing the Group transformation. For the map objects this should work fine. For the "car" object, I would like to apply the same transformation to simplify the positioning of the objects. But, the transformation seems to also be used to draw the shape (i.e. effecting the size of the "car").
I can think of two options:
1. Apply the inverse transform when drawing the shape
2. Draw a bit map
I really just want to be able to draw a simple shape (fixed size in pixels is OK), but at the same time utilise the group transformation for pan / zoom operations. What is the best practice here? If the Rectangle is 20x20 pixels, I would like to offset the Rectangle by 10 pixels to get it centred correctly.
PS
I would like to avoid using an image, since I might need to change it dynamically (minor changes like colour, line-width, etc.).
Edited by: 885374 on Sep 15, 2011 2:35 AM

Hi Zonski
Thanks for your suggestions. The scaling hint was realy helpfull. No luck with the StackPane though, since it seemed to scale the map objects in unwanted ways (got hints about that from the API documentation too). For your convenience, I have included a small example illustrating what I came up with. The example compiles on 'javafx_apps-2_0-beta-b42-23_aug_2011' and you may play with the Zoom factor and Pan offsets to observe the effect.
Please feel free to comment or suggest changes!
package com.demo.javafx;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.SVGPath;
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;
import javafx.stage.Stage;
import java.util.Collection;
import java.util.LinkedList;
* Simple map / track solution demonstrating the use of separate map and track groups to ease pan / zoom operations
* in the map while maintaining the size of the track objects. Below is a illustration of the scene graph:
* root (Group)
*    --> mapLayers (Group)
*           --> mapLayer1 (Group)
*                  --> Blue Polygon
*           --> mapLayer2 (Group)
*                  --> Green Polygon
*    --> trackLayer (Group)
*           --> trackShape (SVGPath)
* Note!
* Coordinate (0, 0) is in the center of the window when PAN_OFFSET_X and PAN_OFFSET_Y is zero.
public class StackPaneDemo extends Application {
    private static final int SCREEN_WIDTH = 600;
    private static final int SCREEN_HEIGHT = 600;
    private static final double ZOOM_FACTOR = 1.0;
    private static final double PAN_OFFSET_X = 0.0;
    private static final double PAN_OFFSET_Y = 0.0;
    @Override
    public void start(final Stage stage) throws Exception {
        Group root = new Group();
        Scene scene = new Scene(root, SCREEN_WIDTH, SCREEN_HEIGHT, Color.BLACK);
        stage.setScene(scene);
        // First map layer
        Group mapLayer1 = new Group();
        mapLayer1.getChildren().addAll(new PolygonShape(Color.BLUE, 0.0, 0.0, -100.0, 0.0, -100.0, -100.0, 0.0, -100.0));
        // Second map layer
        Group mapLayer2 = new Group();
        mapLayer2.getChildren().addAll(new PolygonShape(Color.GREEN, 0.0, 0.0, 100.0, 0.0, 100.0, 100.0, 0.0, 100.0));
        // Create the map group with two map layers
        // 1. The map group is there to be able to pan / zoom all map layers at once (i.e. not each individual layer)
        // 2. Multiple map layers are added to be able to hide map details later (i.e. hide individual layers)
        Group mapLayers = new Group();
        mapLayers.getChildren().addAll(mapLayer1, mapLayer2);
        // Translate and scale the map
        mapLayers.getTransforms().addAll(new Translate(-PAN_OFFSET_X + SCREEN_WIDTH / 2,
                                                       PAN_OFFSET_Y + SCREEN_HEIGHT / 2),
                                         new Scale(ZOOM_FACTOR, ZOOM_FACTOR));
        // Create the a track layer
        Group trackLayer = new Group();
        trackLayer.getChildren().addAll(new TrackShape(0, 0), new TrackShape(100, 100), new TrackShape(200, 200));
        // Translate the track layer
        trackLayer.getTransforms().addAll(new Translate(-PAN_OFFSET_X + SCREEN_WIDTH / 2,
                                                        PAN_OFFSET_Y + SCREEN_HEIGHT / 2));
        // Add the map / track layers to the root node
        root.getChildren().addAll(mapLayers, trackLayer);
        // Show the stage
        stage.show();
     * Simple track representation using SVG Path (need to flip the y-axis)
    private class TrackShape extends SVGPath {
        public TrackShape(final double x, final double y) {
            setTranslateX(x * ZOOM_FACTOR);
            setTranslateY(-y * ZOOM_FACTOR);  // Note: Positive Y should point upwards
            setStroke(Color.WHITE);
            setContent("M0,-10 V10 M-10,0 H10");
     * Simple map object using Polygon (need to flip the y-axis)
    private class PolygonShape extends Polygon {
        public PolygonShape(final Color color, final Double ... points) {
            final Collection<Double> pointsWithFlippedYAxis = new LinkedList<Double>();
            boolean isYCoordinate = false;
            for (Double point : points) {
                pointsWithFlippedYAxis.add(isYCoordinate ? -point : point);  // Note: Positive Y should point upwards
                isYCoordinate = !isYCoordinate;
            getPoints().addAll(pointsWithFlippedYAxis);
            setStroke(color);
    public static void main(String[] args) throws InterruptedException {
        launch(args);
}

Similar Messages

  • APEX Tree.  Keep focus on expanded leaf node.

    How do I prevent my tree from jumping back to the top when I expand a leav node that is below the screen scroll. I have a single parent of CORP with about 30 leaf nodes as its direct children. I have to scroll down to expand a node towards the bottom of the list. When I scroll down and expand, the page refreshes and jumps back to the top so now I have to scroll down again to expand the next node, etc. My current Tree Qurey is like
    select CHILD_ID id,
    PARENT_ID pid,
    CASE WHEN CHILD_ID = :P23_TARGET THEN
    CASE WHEN :P23_STATUS = 'Target Up' THEN
    '<span styl="color:green;">' || ITEM_NAME || '</span>'
    ELSE ITEM_NAME
    END
    ELSE
    ITEM_NAME
    END name,
    'f?p=&APP_ID.:23:'||:SESSION||'::NO::P23_TARGET:'||CHILD_ID link,
    null a1,
    null a2
    from CORP_SVR_HRCHY_VW

    Hi,
    You have to use the Anchor ID functionality of a browser - this allows you to add #id to the end of the url where id refers to the id attribute of the item that should receive the focus when the page is reloaded.
    As an example: [http://apex.oracle.com/pls/otn/f?p=33642:200]
    This, of course, requires a bit of setting up, but is easily doable.
    For this example, my SQL statement for the tree is:
    SELECT 1 ID, NULL PID, 'Top' NAME, NULL LINK, NULL A1, NULL A2 FROM DUAL
    UNION ALL
    select "EMPNO" id,
           1 pid,
           "ENAME" name,
           'f?p=' || :APP_ID || ':200:' || :APP_SESSION || '::::P200_EMPNO:' || EMPNO || '#node' || EMPNO link,
           'node' || EMPNO a1,
           null a2
    from "#OWNER#"."EMP"You will note that the URL contains *'#node' || EMPNO* at the end of the link - for an EMPNO of 1234, this would add *#node1234* to the end of the URL. You will also note that I've added *'node' || EMPNO* to the A1 column - whatever I add into this column becomes available for use in the output by referencing it as #A1# in the template. On the tree's template definition, wherever there is an A tag, I've included:
    ID="#A1#"as an attribute of the tag. For example, on the "Name Link Anchor Tag" setting, I have:
    &lt;a href="#LINK#" ID="#A1#"&gt;#NAME#&lt;/a&gt;and, wherever #A1# appeared outside of an A tag, I have removed it (otherwise, the "node1234" text would appear at that point in the page).
    Andy

  • How to Find the node or leaf node selected in Tree UI element:

    Hi All,
    I have a tree structure with three level design. We have a button, which will perform some operation on the specific node or leaf node on every level.
    When we select any node or leaf node, we have action Onction getting called.  But what we want is that, after we select the node or leaf node,  we press a button below the tree design and perform some operation on the node selected.
    But how to get information that on Application , which node or leaf node has been slected ?
    Thanks
    PG

    Hi,
    Found the solution.
    Juts keep on reading all the nodes, system gives the complete path of the tree by using Lead selection and then we can use this path to peform the update operation on tree structure.
    Thanks alot for the hint.
    Regards
    PG

  • ADF TreeTable - How to hide Disclose/Expand icon for leaf node

    We are using ADF Tree Table in our application.
    Whenever a node is expanded - all the child nodes have the disclose/expand icon along with it.
    But, we don't want to show the disclose/expand icon if it is a leaf node.
    How can this be done?
    JDeveloper Version: JDeveloper 11.1.1.3
    Thanks,
    Navaneeth

    I have a hierarchical tree based on single POJO based class exposed as data control.
    (i.e) a node can have many levels.
    Can you specify how we can use the folder icon for this - Can you please provide some detailed information?
    Thanks in advance,
    Navaneeth

  • How to make the leaf node of the APEX tree downloadable

    Hi All,
    I am trying to build a "library" page for my application, with the documents as the leaf nodes of the tree. The documents come from a database table, and each document is a BLOB.
    My question is, how should I write the "link" part of the APEX tree query to make the lead node document downloadable for the end users?
    Thanks,
    Christine

    Hilary helped me out of this by creating a new form page with two new items there corresponding to the PK and BLOB column, then in the tree query use apex_util.get_blob_file_src function as the link. Below is the email from Hilary:
    1. Created Form, page 13, based upon your table storing the documents as BLOBs. The form page has just two associated items: P13_DOC and P13_DOC_ID. The item P13_DOC is of type FILE and contains a source type of DB column, which is the first required parameters of the function get_blob_file_src. NOTE: I could have created a form region on the same page as your tree, but chose to generate a separate page. You may choose to change this yourself.
    2. Updated the Tree query on pg 12 to use the following link for tree nodes of level 4:
    apex_util.get_blob_file_src('P13_DOC',v.attr3)
    ...where P13_DOC is the application page item mentioned in step 1 above, and v.attr3 should hold the unique ID associated with the document. Your tree now allows users to download the listed documents.

  • How to get the leaf node in a hierachy????

    if i get a record that a parent node in a hierachy table ,so how can i get the leaf node of this parent node quicklly?????thank you!

    Hi xuhuanjun ,
    Refer to the below threads which disucss the same.
    Re: how to ensure a hierarchy tree's node is a internal leaf???????
    Re: Retrieve Hierarchy Leaf Node using API.
    Hope it helps.
    Thanks,
    Minaz

  • Hierarchy VIewer - Card only on Leaf nodes

    I am using version 11.1.2.3.0.
    Is there a way to show a Card only on the leaf nodes of the Hierarchy VIewer?
    I have information that only applies to the nodes on the very bottom of the tree.
    Thanks in advance.

    This should be possible.
    I've not tested this but you can use the rendered property of the panelCard component and set it to an EL which evaluates to false is the node has children (node.hasChildren? or some other data which lets you know if you want to show the card).
    If this does not work you leaf the rendered property as is and use the visible or rendered property of the component which holds the information you only want to show in leaf nodes.
    Timo

  • How to test a 'leaf' node when parses a DTD?

    Hi All:
    Suppose I have <!ELEMENT Name (#PCDATA)> in my dtd. What is the correct way to test the node is a 'leaf' node? I am thinking to use ElementDecl.ELEMENTS to eliminate leaves. Is it correct? As far as I see, the type of leaves is ElementDecl.MIXED. Please verify.
    Thanks!
    Frank

    Hello Sai,
    I am afraid you have posted your question in the wrong forum. This forum is about Oracle On Track Communication, a next-generation social enterprise collaboration product.
    Please re-post your question in an ADF related forum and I am sure someone will be able to answer.
    Thank you,
    Ernst.

  • Hierarchical query - Stop at specific leaf nodes - How to in Oracle 9i ?

    Table H -- Master table to build Hierarchical tree
    C -- Child
    P -- Parent
    Table RN -- Table defining Root Nodes
    N -- Node
    Table LN -- Table defining Leaf Nodes
    N -- Node
    The following Query can generate trees starting with the nodes specified in the Table:RN
    SELECT LEVEL L, C, P, SYS_CONNECT_BY_PATH(C,'/') SCBP
    FROM H
    START WITH C IN ( SELECT N FROM RN )
    CONNECT BY PRIOR C = P
    How do I limit the tree to the nodes specified in the LN table ?
    "CONNECT BY" does not support "IN" clause
    i.e
    CONNECT BY PRIOR C = P AND P NOT IN (SELECT N FROM LN)
    Say we have 2 trees
    1-2-3-4-5
    A-B-C-D-E
    RN : 2,B
    LN : 5,D
    Result:
    2,3,4 (5 is excluded)
    B,C (D is excluded)
    Any help is appreciated...

    What about:
    select level l, c, p, sys_connect_by_path(c,'/') scbp
      from (select * from h
             where c not in (select n from ln))  -- filter via an inline view
    start with c in ( select n from rn )
    connect by prior c = p;

  • Identifying leaf node in a JTree

    I have a single selection JTree which was constructed using DefaultTreeModel.
    asksAllowsChildren is set to 'true' in the tree model.
    The nodes in the model are constructed using DefaultMutableTreeNode and each
    node is marked if it allows children or not.
    How can I find if a selection is a leaf node or not.
    Thanks.

    Answering my own post, solution is:
    tree.getModel().isLeaf(tree.getSelectionPath().getLastPathComponent())
    where tree is the JTree object.

  • Drill and Navifgate only from leaf node

    Hi
    I have implemented level based hierarchy for my dimension. I want to navigate to another report only from the leaf node of the hierarchy.
    Can you please let me know how can this be achieved? How can i identify the leaf node in a level based hierarchy

    This is not a duplicate of the item mentioned. With one I have a node anywhere in the tree and need to walk up to find the parent. In this one, I have the parent and need to delete leaf nodes up to this parent. I each one I have a different set of constraints and different ids to work with. Thanks for your help.

  • Leaf nodes in Flex cluster

    Hi,
      can somebody explain what leaf nodes in flex cluster are?from documentation I see that they are nodes which dont have access to storage and they communicate with hub nodes.
      Can they have oracle db instances?If so how is data transfered between hub and leaf nodes?Through interconnect?Doesn't it overload the interconnect?
    Thanks
    Sekar

    Sekar_BLUE4EVER wrote:
    Thanks Aman...Still confused about this...Consider the following scenario
    |       H1       |<------->  |        H2         |   <------> |       H3        |
    |                   |              |                      |               |                    |
    | L1  L2  L3  |              | L1   L2   L3   |               | L1  L 2 L3   |
    | _________|              |___________|               |__________|
    H depicts the hub nodes and L depict the leaf nodes.Assume each Hub node has 3 leaf nodes attached to them.
    Suppose L1 connected to H1 needs a block and modifies it and after sometime L1 connected to H2 needs the same block then it must follow the same 2 way/3 way grant as in normal cache fusion right?
    Does this actually increase the number of hops since the leaf nodes are not directly connected?
    Do we have any control over the leaf node to hub node mapping or is it all automatically managed?
    Thanks
    The blocks are going to be accessed, modified at the Hub nodes only AFAIK as the Hub nodes are considered as DB Nodes. The Leaf Nodes are going to be considered as the Application Nodes. That's the reason, it's better to set up the instances running on the Hub Nodes only rather than the Leaf Nodes. Even if the instance runs on a Leaf Node, the communication is between the Hub and Leaf node only and it won't do any harm as both the nodes-Hub and Leaf(and the other nodes in the Leaf group) would be talking to each other directly. There is no VIP required on the Leaf Nodes so the connections by the database users would be only on the Hub Nodes, I guess and that means, the block movement would remain essentially the same.
    The number of network hops are reduced as you won't be having a requirement to have too many Hub Nodes since each Hub node can connect to  64(?) Leaf Nodes. So essentially, in your case, you would need only 4 Interconnects (2 on one Hub Node and 1 each on the remaining two) for the private interconnect and just 3 network links for the storage for each Hub node.
    I am not sure that I understood the last question of yours.
    HTH
    Aman....

  • Hierarchical Query from a leaf node

    I have thist table
    create table employee(
    emp_id number(7) not null
    name varchar(30)
    supervisor_id number(7)
    Constraint PK_employee primary key(emp_id))
    This is my data
    Insert into employee(emp_id,name) values (1,Boss)
    Insert into employee values(2,Subordinate1,1)
    Insert into employee values(3,Subordinate2,1)
    Insert into employee values(4,Subordinate3,1)
    Insert into employee values(5,Subordinate4,2)
    Insert into employee values(6,Subordinate5,5)
    Insert into employee values(7,Subordinate6,3)
    In my program, I'll be given the leaf node lets say, Subordinate5, I want to get the whole hierarchy for that subordinate like this:
    Boss\Subordinate1\Subordinate4\Subordinate5
    or Subordinate 6
    Boss\Subordinate2\Subordinate6
    Help will be greatly appreciated. Thanks.

    Here is another - a little bit rewritten - version:
    michaels>  SELECT full_path
      FROM (SELECT LTRIM (SYS_CONNECT_BY_PATH (NAME, '\'), '\') AS full_path
                  FROM employee e
            CONNECT BY PRIOR emp_id = supervisor_id ORDER BY LEVEL DESC)
    WHERE ROWNUM = 1 AND SUBSTR (full_path, INSTR (full_path, '\', -1) + 1) = 'Subordinate5'
    FULL_PATH                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    Boss\Subordinate1\Subordinate4\Subordinate5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    1 row selected.

  • Hierarchical Dimension with a leaf node w/o any parent

    Hi
    We have a Product Dimension with five levels L0, L1, L2, L3 and L4 (L0-lowestlevel, L4-HighestLevel).
    With one Hierarchy STANDARD as
    L4, NULL (Parent)
    L3, L4 (L4 is the parent of L3)
    L2, L3
    L1, L2
    L0, L1 (L1 is the parent of L0)
    The product dimension table has a record with values only for L0 and NULL values for other Levels..
    (ie) We have a requirement to create a value in L0 which will have no parents.. The rest of the values in L0 will have parents.
    Would like to know if this is possible in AW. This was possible in Express Server
    regards
    uma

    HI
    yes we have run into a big problem. We have created leaf nodes w/o parent in aw and created relational views of those. The measure views thus created has data for these dimension values but when accessed thru BI Beans (ie in the cross-tab if we have this measure) the data is not getting displayed for these dimension values (Which do not have parent)
    Any immediate response will be of greate help to us.

  • TechTool 4 Volume test and "invalid leaf node"

    Just a "heads up". I just installed TechTool 4 and ran the usual diagnostics as a level-set. I was surprised to discover that I had two volumes with invalid leaf nodes. To make a long story short, the discussion with TT support revealed that there's apparently nothing wrong with my drives. They've both been re-formatted, surface scanned, repaired, etc. I've never had any errors from either of them. One is a Seagate 250GB and the other is a WD 160GB. TT support asked to borrow one of my drives for a couple weeks(!) because they think it's a bug and can't reproduce it. Disk Utility says there's nothing wrong. Take Volume Scan leaf node errors reported by TT4 with about a pound of salt, since the bug is still there (and will be, since I can't live without the drive for weeks and they won't buy it). I'm reporting it here, because they suppressed the majority of our discussion on their forum and I don't particularly approve of them hiding a known bug from customers. I have the TT logs and anyone who wants to see them can just ask, BTW. This isn't a vendetta against them so much as an attempt to spare others the 2 days of lost work I experienced while running various things for TT support, all to find out that I'm not the one with the problem.
    Mac Pro   Mac OS X (10.4.9)   3GHz, 4GB

    Oh Yeah, that I know. I run two intermediate backups and a full clone daily. The awkward thing is that one of the drives is my "snapshot backup" drive, naturally. They swear that they've only had one other report of this and it went away with a reformat. Mine did not. You'd think that a reformat and surface scan would reveal a hard, repeatable, drive error - which TT4 implies I have. What are the odds that I have two drives with a totally unique problem (such as they described it), made by different manufacturers, with hard and repeatable errors that only their program can detect? SMART says they're OK, Disk Utility says they're OK, no errors are logged, their temperatures are the same. If this error is so rare, how is it that I just happen to have it on 50% of my drives? It's been a Royal Pain to re-jigger my drives so that the backups go to a drive that doesn't have the "error", just in case.

Maybe you are looking for

  • Can not read data from URL!

    Hello, I want to read data from URL (http://84.100.130.82:8000/;stream.nsv). But can not do it. Because when try to call function openDataInputStream() shows this error: java.io.IOException: response does not start with HTTP it starts with: ICY. How

  • SO_DOCUMENT_SEND_API1 - Filename extension

    Hi Experts, I am using FM SO_DOCUMENT_SEND_API1 to send an excel attachment. I am passing filename 'UPDATE_LOGS' in packing list but when I check in SO01(Outbook) file name for extension is UPDATE_LOGS_YYMMDDHHMMSS.xls". How to I correct this.Heres t

  • Delete key function reset required

    The delete key in Safari always returned to the previous page browsed. Now, for some reason, it only functions as a regular delete key and no longer moves back a page. This happened for, seemingly, no reason, I didn't reset anything. Any ideas how to

  • Cannot connect to the net using my wi fi on my blackberry curve

    hi there, i cannot connect to the net using my wi fi on my blackberry curve 8520. wen i go in to settings and click on to manage connections it as a tick at the side of wi fi  and says TALKTALK- 3B0BD4 and a tick at the end. if i turn my mobile netwo

  • Macbook pro fails to auto connect Internet after rebooting wifi router

    My macbook pro with retina can't automatically connect to wifi after the wifi router was rebooted. There is exclamation mark on wifi sign. As the picture shows, when I clicked the wifi sign, it shows no Internet connection. However, It is strange the