Different views for the same shape….

Started by DC Kelley, April 26, 2010, 11:45:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DC Kelley

I am working on the conceptual design of an application where the user edits a set of joined lines (a collection of simple straight line segments, each with a "width" value) to place each end point along a curve that represents a city street or road.  While most of the time I want this line to appear fairly thin so the user can visually confirm they are placing the points along the center line, at other times I will want to paint the line "fat" using the street lane width values to proportionally set the line width to represent the actual width of the street at that point.  In a typical use there are 2~8 of these lined up along side each other to represent the separate travel lanes of the road segment.

How can I develop a single shape that has two distinct visual views and then control the toggling between these views programmatically so that one or the other is drawn?

I was planning to make this out of 1-dim lines joined up end to end, but as I consider the problem further perhaps a 2-dim object, i.e. a series of thin rectangles joined at the center of each end, is a better choice (then the width becomes one side of the rectangle rather then the pen width).  When the project is done, the actual endpoints are the data I will be extracting and then scaling to real world values. 

Paul Herber

Put the thickness into a user-defined cell on the page pagesheet, then each line can reference this value.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

DC Kelley

#2
Actually I was planning to make the width attributes part of the A/B/C/D geometry formula, in each moveto entry, that part is easy.

The hard part is how do I control or set some state that will render the shape one or more different ways (in this case either a thin centerline or a collection of fatter lines/rect) every time things are redrawn.   That is the basis of this post and I am still not clear on how to develop a suitable solution.

Quote
Put the thickness into a user-defined cell on the page pagesheet, then each line can reference this value.
Actually, there is a unique width (likely different) for each and every lane, so a global is not quite what one wants although in practice most lanes in most street intersections are built with the same geometry rules (and the actual ASN-BER encoded message does use a default value for this need to save a few bytes).

Again, the problem is how to toggle between two different visual renderings

DC Kelley

I noticed an example here where the  "Mr Visio guy" icon changes its displayed style when it was moved off the edge of the page, how is this being accomplished?  Perhaps I can use that to solve the topic of this thread.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 201 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1048KB.
Tokens: post-login.
Cache hits: 13: 0.00339s for 26,588 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]