260 views
in GUI Development by

Hi Team,

We have a use case similar to the below example where we have to highlight one particular route(path to one exit) at a time based on dynamic input.

Can this be achieved using Stroke path by 

- creating 4 Paths, where each path contains multiple lines and curves connected to each other to form a route

- and setting the required path data to the stroke path at a time

Can you please provide your suggestions on this?

 

Thanks & Regards,

Kavya

1 Answer

0 votes
by

Hello Kavya,

I'm not sure whether I understand what you mean with "... and curves connected to each other to form a route". If your idea is to create a separate path data objects for each possible exit and depending on the preferred route select the right object in Stroked Path view, then yes, this is possible. In this case the selected path data object defines one exit (one arrow from the image above).

You can also maintain one path data object and modify it dynamically at the runtime. When you want to highlight the first exit then you load the path data with the coordinates for the corresponding arrow. If you want to highlight the third exit, then the corresponding coordinates are loaded.

If you want multiple exits (multiple arrows) to be defined within one path and display this shape in the Stroked Path view, you have to store each exit (each arrow) as separate sub-path within the path. For example, I have created a path containing 2 sub-paths. Following is the code I have used here:

// The path should store up to 2 sub-paths
Path.SetMaxNoOfSubPaths( 2 );

// Initialize the first sub-path.
Path.InitSubPath( 0, 2 );
Path.Begin( 0, 150, 50 );
Path.AddLine( 0, 150, 150 );

// Initialize the second sub-path.
Path.InitSubPath( 1, 2 );
Path.Begin( 1, 50, 100 );
Path.AddLine( 1, 250, 100 );

When this path is then connected to a Stroked Path view and this view is configured with its properties StartCap and EndCapGraphics::PathCap.Triangle following outputs are visible:

Depending on your application case, I would also consider to use the Filled Path view instead of the Stroked Path view. When using Stroked Path view, all exists (all arrows) will have the same width and the same style for start/end caps. These properties are common for the Stroked Path view. With a Filled Path view you are more flexible and you can construct the path more precisely. For example, the diverse exists (arrows) may have different width. Doing this, however, you will need to provide the outline of the desired shape. You have to construct the outline from line segments and arcs as explained in Store data in a sub-path.

Does the answer help you further? Or did I not understand the question correctly?

Best regards

Paul Banach

by

Thank you Paul.

"...lines and curves connected to each other to form a route" by this I mean the following examples (path drawn in blue, whereas the background will be static)

   

And would there be any memory/performance impact while drawing large number of paths for many different images like this?

by

Hello Kavya,

thank you for the further images. It is more clear now. In such case it would be sufficient to have one path data object and depending on the desired 'exit' load the path data with line segments and arcs for the corresponding route. To display the path you can also use the Stroked Path view since the entire (blue) path seems to have the same width. This will simplify your implementation.

And would there be any memory/performance impact while drawing large number of paths for many different images like this?

Unfortunately, yes. It is, however difficult to give you a concrete numbers how much RAM or CPU power is needed in your application case and especially your HW. You will need to try it. Following are the general aspects valid for all application cases:

- The more path data objects exists the more RAM is needed to maintain the data in memory.

- The more complex a path (the more line segments, edges, arcs, ... it contains) the more CPU intensive is the evaluation of the data while the path is rendered. Also the more complex a path the more RAM it will occupy.

- The dimension of the path (the width and height of the resulting figure you want to display) will also affect the performance. The larger the figure, the more pixel need to be evaluated and copied when rendering the path.

Does it help you further?

Best regards

Paul Banach

 

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...