When we load any dwg file into the ACC viewer we want to be able to easily select (click) and color (theme) the polylines/polygons that represent spaces.
If you simply load a dwg the only way to select a Polyline in the graphic is by clicking exactly on the outline of the element – clicking on the inside of a polygon does not lead to it being selected. When a polyline is selected it is very hard to notice that it is selected because only the polyline changes its color and not the filling of it.
In the picture below I selected a polyline that describes the orange colored space (it is slightly blue now). I want the entire polyline to be filled.
This also means it is not possible to fill the entire polyline in one color using the setThemingColor.
When I try calling that function I don’t notice any visible change of the space.
We solved this problem by editing the original dwg and adding Solid (or Hatches) on top of each polyline and that works nicely. We can click these hatches easily (by also clicking somewhere inside of it and not only the line itself) and color them properly.
This is an example of a selected hatched space:
Now we need a way without editing the drawing file itself. I could think of several options but I was wondering which one is possible and the easiest to do.
- Is there a setting in the viewer I am missing that will allow this?
- Could I add those hatches manually at runtime when the drawing is loaded ontop of each original polyline in the dwg?
- I guess one could catch click events on the viewer and calculate inside of which element the user clicked and then select that element per api. This could work for the easier selection but wouldn’t solve the coloring problem…
Be aware that the filled polylines/hatches should be at the lowest level in the drawing so all of the other elements are not visibly blocked by it – this order should be defined in the drawing already.
As a bonus we would also be interested in having a similar solution for any kind of blocks:
Clicking is more important for the blocks than the filling of it so the 3rd solution might work for them.
How would I implement the above ideas – if they are possible? Or is there a better solution?