Example: Edit Covered Objects

Working with drawings where within the same drawing some areas completely cover smaller areas is a bad idea, but sometimes we have to work with data in that form whether we like it or not.   This topic shows techniques that can help us select and edit objects that are completely hidden by higher objects.


ico_nb_arrow_blue.pngThis topic has not yet been fully updated to reflect extensive new features and changes made in build  Please see the Changes and Additions topic for a guide until this topic has been updated.tech_angus_sm.png


Important: When objects completely cover other objects that is a situation best handled by using multiple drawings, so that objects which cover other objects can be placed into higher or lower layers as desired.   Layers are the user interface element that allows us to deal with "higher / lower" relationships in a simple, point-and-click way.   If we must keep data in a form where higher and lower objects are stored within the same drawing, that necessarily complicates things.   


The techniques below are mostly a collection of practical hacks as an experienced user might apply them.   Some, such as alt-clicking on an object and expecting to choose the lowest object (the object which is drawn first because it was encountered first) might not apply in all cases.  For example, when many threads are generating many different objects to feed to the rendering engine there is no guarantee what will be considered upper or lower.   The techniques described in this topic are still worthwhile hacks to try in most cases, before resorting to more intricate workflow.

When Larger Areas Cover Smaller Areas

When several different objects are located at exactly the same locations with exactly the same shapes it is a good idea to keep them in separate drawings.  For example, if we create three points at exactly the same location within the same drawing when that drawing is opened it will appear that only a single point exists at that location: when all three points are stacked on top of each other at exactly the same location, if they are styled the same way there is no visual indication there are three points at that location.


Within the same drawing Manifold will draw areas first, lines second and points third.  That rule ensures that points will not be hidden by areas above them.   Areas are drawn in whatever order the database engine fetches them.  Since tables are unordered, areas may be drawn in various orders.   Since rendering can be optimized through the use of multiple threads or by other means, there is no guarantee that even if records within a table are displayed in some order that area rendering will match that same order.


Likewise, when larger areas are located and sized so they completely cover smaller areas in the same drawing, there is no visual indication that a smaller area might be underneath the larger area.


Consider the illustration above, showing a drawing as if it were seen in an inclined view, representing a drawing where two smaller triangular areas have been drawing below two larger rectangular areas. The illustration represents a single drawing, where all four area objects are in that same drawing.  It does not show two drawings as layers where one drawing is a layer above the other drawing.




In real life, of course, drawings are not something we can tilt and look into.   In real life, we would see that drawing as above.   If areas use a solid area style we could not see through the upper areas and we would never know there are two triangular areas underneath.    


Given the popular use of solid area styles to format areas in drawings, because we cannot see smaller areas that happen to lie under bigger areas within the same drawing, it is a very bad idea to arrange our data in drawings so that smaller areas are hidden by bigger areas.    When smaller areas are hidden by bigger areas,  a tremendous advantage of GIS, the visual cues a drawing gives us by displaying data visually, turns into a big disadvantage because we cannot trust the visual cues we see.   If something is hidden, then we no longer have the benefit of "what you see is what you get."


Therefore, we should do all possible to clean up our data and to organize it as best as possible to avoid situations where larger areas are drawn to overlap smaller areas.    When that is not possible and we find ourselves having to work with such unclean data, the tips in this topic can help.

Transparent Area Fill Color

The simplest way to show smaller areas that fall below larger areas is to use transparent color for area fill color in the Style pane.


eg_edit_covered_objects01_03.png  eg_edit_covered_objects01_03a.png


We alter settings in the Style pane so the area color used for borders is a thematic format using the above palette based on mfd_id, and we set the area Fill color to transparent.




Right away, the hidden areas appear.   The problem with the above style settings is that we cannot tell what is a figure drawn with lines and what is an area.  




We can fix that by using a hatch pattern style.   We choose the vertical lines hatch pattern in the Symbol button, and then we press the Rotation button to apply a thematic format that varies the angle of the hatch lines.




The hatch pattern is drawn using foreground color, with transparent color used for the area fill.  That allows the lower areas to be seen through the upper areas.

Select and Delete

After using transparent color for area fill and hatch patterns for styles we can see formerly hidden areas.  We can then utilize various mouse moves to select and to otherwise work with whichever area we want.    We begin with selection.




Ctrl-click on the blue hatched area, clicking on a spot safely outside the red hatched area underneath.




The upper area is selected.  




We can press Delete to delete it.

Adjust the Selection and Delete

Suppose we would like to select the lower area?




Ctrl-click within the bounds of the orange hatched area.




Both the orange hatched area and the larger, pale green hatched area are selected, since the click was within both.   We now Shift-Ctrl-click onto the selected larger area to deselect it, choosing a location to click that we know is safely outside the smaller area.  




The result is that the larger area is deselected while the smaller, lower area remains selected.




We can now press Delete to delete the smaller, lower area.

Alt-click to Edit

When multiple objects are stacked on top of each other in the same drawing, what object an Alt-click chooses can depend on happenstance, but usually the first object encountered in the table and thus the lowest object rendered (because it is rendered first) is the one which is chosen.   We can exploit this by Alt-clicking onto the lowest object to choose it.




In the illustration above, we have Alt-clicked onto the red hatched triangle, which has been rendered below the blue hatched rectangle.




That chooses the red hatched triangle, displaying field values in the Record pane.  




To edit the shape of that red hatched triangle we could click the Coordinates tab of the Record pane, or we could have Shift-Alt-clicked the red triangle.




To clear our choice of a picked object we can Alt-click in a blank spot to clear our choice of the triangle.




If we would like to pick a different object, we can simply Alt-click or Shift-Alt-click on it.  For example, we Alt-click on the larger, blue hatched rectangle.




That picks the larger, blue hatched rectangle, instead of the smaller, red hatched triangle.

Alt-Click and Overlaps for Next / Previous Ordering

As with any high-end database, records in tables in Manifold cannot be assumed to have any order, especially when we link in a drawing and table from an enterprise-class database, like MySQL, Oracle, or PostgreSQL.    Therefore, when we pick an object with an Alt-click we cannot assume that the Next and Previous buttons in the Record pane will jump to nearby objects and not far across a drawing full of thousands or millions of objects.


A useful exception to that "no order" rule is that when we Alt-click in a location at which more than one object overlaps, the Alt-click will pick one of those overlapping objects, but it will also build a virtual order for up to nine more of the overlapping objects for the purpose of Next and Previous ordering.    That allows us to quickly use Next and Previous to step through the objects that overlap at the Alt-clicked spot.   If we keep pressing Next past the collection of overlapping objects, then the usual jump will happen to whatever object is next beyond that initial collection of overlapping objects.




We Alt-click a location within both the red triangle and the blue rectangle.




One of the two overlapping objects is picked, the red triangle.  




The Record pane automatically opens as well.  


btn_next.png  We can click the Next button to see the next record.    The usual situation in a database is that the next record could be any object at all, and not an object near the red triangle that is the current pick.  However, Manifold arranges a virtual order for all objects intersecting the spot that was Alt-clicked so whatever comes next will be one of those.




The next record is the blue rectangle.    This may not be so impressive in a drawing with only four objects, where only two objects overlap in the Alt-clicked position, but the effect becomes much more valuable in a drawing with millions of objects where several objects may overlap in the same spot.   It then becomes very useful that all of the objects overlapping at that spot form a virtual grouping, all together at the very beginning of the Next / Previous sequence.


If we pressed Previous we could go back to the red triangle.




btn_next.png  In the Record pane, if we press Next we go past the virtual order for the two objects that overlapped at the Alt-clicked position, and we continue to whatever is next in the random order of the table.




In this case, that happens to be the yellow triangle.

Alt-click Through an Object

We can choose a first-drawn, and thus lower, object even if we cannot see it.




Suppose we use solid area style so we cannot see objects below the larger, upper objects.   We can Alt-click into the middle of the blue rectangle where we know the click falls within the bounds of the unseen red triangle underneath.




Even though it is not seen, the red triangle underneath is chosen.  A blue preview of the outline together with edit handles at the vertices of the area appear.    This is clearly a hack, but sometimes it is a very quick and convenient hack.    


We can press the Next button in the Record pane to jump to the blue rectangle, if that is what we wanted.

Manage Objects using a Field

We can create a new field in a table and use it to choose higher or lower objects.   Such fields are often called "Z" fields because they specify higher or lower order of rendering.   Since heights in GIS are often called Z values (as in the third dimension, Z, after X and Y dimensions) the lower to higher order in which objects are rendered is called Z ordering.




Suppose we add a field called Size and for the areas in our sample drawing we assign the value of Small, for the smaller triangles, or Big, for the bigger rectangles.  We have also edited the Name of the objects to simplify names from using colors, as in "red triangle" to simply "triangle."




We can provide more systematic visual cues on what is higher or lower by doing thematic formatting based on the Size field.




In the above, all Small objects have been formatted pale green and all Big objects have been formatted orange.




We can use a quick hack to "hide" the Big objects by double-clicking into their color well in the thematic format and changing their color to transparent color.




The result is that the upper, Big objects, those that normally hide the lower, Small objects, seem to disappear.   That gives us a clear view of the lower objects.   But this is a hack, a risky hack at that, to use thematic formatting to hide some objects.




We double-click onto the color well in the thematic format for the Big objects and choose orange color, and then we press Update Style.




That makes the Big objects re-appear.

Using the Select Pane

We can exploit the contents of records to select areas based on fields.   In what follows we have restored the prior thematic formatting, using red, blue, orange and green colors.




To select the smaller areas below the larger ones, we can use the Select pane to select records with Small in the Size field.





Right away, the Select pane will preview what will be selected.    We press Replace Selection.




That selects the two triangles in the drawing.  We can then Shift-Ctrl-click either of the areas we wish to de-select, if we do not want to select them both.



The corresponding records in the table are also selected.    We can de-select records in the table if we prefer.

Copy Lower Objects into a New Layer

It is so easy to copy and paste objects that we can use copy and paste to make copies of areas that might be hidden by other areas.




To copy areas, in the table we then press Ctrl-C to Copy the selected records.   If the drawing's table is not open, we can right-click the Drawing tab and choose Open Table to open the table for that drawing.   


Next, in the Project pane we press Ctrl-V to Paste or we click the Paste toolbar button.  That creates a new table.  We right-click the table and choose Create - New Drawing, and we name the new drawing Small, a name we choose to remind us what the drawing contains.




We drag and drop the Small drawing as a layer into our drawing.   It now shows exact copies of the two triangles that were rendered below the larger rectangles.   In the illustration above, we have used solid area style, to show how the upper, Small, layer can be used as a guide to show objects that are hidden below solid-colored areas.


This is a quick and dirty way of exploiting layers to get access to objects that are hidden in below other objects, or which are otherwise difficult to choose.   If we want to see field values for either of those triangles, we can just Alt-click the one we are interested in.  Because it is an exact copy, with attribute values the same it gives us the same read-out in the Record pane as would the original object that is hidden from view in the Drawing layer.

Use the New Layer as a Guide Layer

Even if we now use a solid style in the Drawing layer, we can still see from the Small layer where the lower triangles are located, by using what we can easily see in the Small layer as a guide.




In the illustration above we have used Style to format the Small drawing areas in yellow color, and then we have used the Layers pane to make the Small drawing only 40% opaque, that is, partially transparent.   We have clicked the Drawing tab to move the focus onto the Drawing layer.    Now, when we Alt-click that click will apply only to objects in the Drawing layer.   We can use the objects in the Small layer above it as a guide.





The blue preview and vertices are a preview of the lower, unseen triangle that is in the Drawing layer and below the larger, blue rectangle.   If the wrong object (the rectangle) was picked when we Alt-clicked, we could have pressed the Next button to pick the other object that overlapped at the Alt-clicked position, the triangle.




In the Record pane we click the Coordinates tab to switch the vertex boxes into edit handles, and then we drag one of them to a new location.  In the Record pane we click Update Record to apply the change.




The result may be visually unexpected:  when we edited the lower, previously-unseen triangle we made the record a "newer" record in the table.  It now is drawn after the larger, blue rectangle so it now appears above the larger, blue rectangle.   


We Alt-click outside any of the objects to un-pick the red triangle, for a simpler display.




What we see in the display above is the red shape of the edited object.  Part of it appears orange because we are seeing that part of the red shape through the partially-transparent yellow triangle in the Small layer above.   The combination of partially-transparent yellow plus red results in an orange color in that region.




Double-clicking the Small layer off, we can see how the Drawing layer now looks.   What used to be a smaller, red triangle that was rendered below the larger, blue rectangle has been reshaped by our editing and is now drawn above the larger, blue rectangle.

Misconception: Query to Order By Z

It is easy to forget that the order in which records appear is not the order in which we can safely assume they will be rendered.    This especially can lead to error if we crate a Z field we intend to give the rendering order, and order the table by that Z field.  Such fields are often called "Z" fields because they specify higher or lower order of rendering.   Since heights in GIS are often called Z values (as in the third dimension, Z, after X and Y dimensions) the lower to higher order in which objects are rendered is called Z ordering.



In the table above, we have added a Z field with numbers from 1 to 4 for each object.




We can write a query called z order that generates the same table, but ordered as a results table based on Z value.   The query text we use is:


SELECT * FROM [Drawing Table]



We can then create a drawing from that query using the procedure described in the Example: Create a Drawing from a Query topic.  We style that drawing the same as the drawing used in the illustration above.




At first glance, the drawing seems to do what we might expect.  It renders objects in their Z order as given in the results table of the query.  Because the orange triangle comes last in the table (with a Z of 4) it is rendered last, above the larger, pale green rectangle.    The red triangle comes first in the results table (with a Z of 1) so it is rendered first, that is, below the larger, blue rectangle.


But this is a case where results using small data and a simple situation are deceiving.   There is no guarantee in what order objects will be rendered regardless of the order in which they appear in a table when there are larger numbers of objects or more threads.   Suppose we have a complex query that runs using many threads, but it generates relatively few records in the results table.   Despite having few objects exactly in what order the different threads contribute to that results table is not predictable, and the order in which records are taken from that table to be drawn is also not predictable.    


Therefore, we can use a field like the example Z field to guide our work with selection if we want to select and then copy and paste, but we cannot force a display, at least not yet, to be rendered in order based upon a field.  It is likely as Manifold evolves that in the future options will be added to use Z order for rendering.  Stay tuned!


Tech Tip: This topic uses a simple query to generate objects, so we can create a drawing from that query.  It works perfectly, but at the cost of the system asking us if we would like to build a temporary spatial index whenever we open the drawing that was created from the query.   We can avoid that by using a slightly more sophisticated query that automatically generates a spatial index on the geom field.  The more sophisticated approach is illustrated in the Example: Create a Drawing Dynamically from a Geocoded Table  topic.


The more sophisticated query:  


TABLE CALL TableCacheIndexGeoms((

  SELECT * FROM [Drawing Table]

    ORDER BY [Z]

), TRUE);


As explained in the Example: Create a Drawing Dynamically from a Geocoded Table  topic, wrapping our simple query within a use of the TableCacheIndexGeoms function will automatically generate a spatial index for the Geom field.

See Also





Editing Drawings


Style: Drawings


Style: Thematic Formatting


Layers Pane


Record Pane


Example: Draw Lines, Areas and Points - Simple example of using basic mouse moves to add points, lines and areas to a drawing.


Example: Trace an Area in a Map over an Image Background - In a map with a drawing layer above an image layer, create an area object in the drawing by tracing over the outlines of something seen in the image layer below.


Example: Edit Coordinates While Creating an Object - When creating an object in a map using a tool such as Create Area, right in the middle of the process we can edit coordinates in the Record Pane pane's Coordinates tab.   This example shows the step by step process.


Example: Edit Attributes and Move a Point - We look at the attributes for a point in a drawing layer and edit one of the attributes using a more expanded Edit dialog.  We then move the point to a new location. Easy!


Example: Create a Multipoint - This topic provides two examples:  First we create a multipoint and then next we create a multipoint having two branches.  The purpose of this topic is to help teach the implementation of geometry in Manifold and other spatial packages using an unusual and rarely met object type, the multipoint, which combines what appear to be many separate points into a single multipoint object.



Manifold Future - Future Tour Part 1 - This video shows how to download and use a portable installation for Manifold Future.  The video also shows the Contents, pane, layers and layer opacity, one click use of data source favorites, using your own archival favorite and getting record values instantly.  If you are using Viewer or Radian Studio, download and use the Future version to get access to all these powerful new features.


Manifold Future - Future Tour Part 2 Editing - The video shows how to create new objects, how to add fields and vertices and move vertices around, how to edit existing objects and how to use simple selection methods to choose vertices to move together, including moving all objects.


Manifold Future - Future Tour Part 3 Editing - The editing tour continues with a look at how to create branched objects, including how to create areas with holes and islands, how to add branches to lines and how to add coordinates between vertices in existing objects.  We finish up by creating an area that traces over a pond in the Luxembourg Gardens in Paris using a Google satellite view, and then we add a hole to that area and two additional islands.


Manifold Future - Future Tour Part 4 Edit Attributes, Move a Point - We use Manifold Future to see how to view attributes of objects in drawings, including use of the new Edit dialog to view long, multi-paragraph text fields.  We edit fields and see how easy it is to preview edits and either accept them or abandon them. We switch to editing the geometry of objects in a drawing, viewing the coordinate locations and using mouse moves to reposition points. We edit the location of a point to correct an error in a drawing, using Google Satellite view to provide context for the correction.  Fast and easy, with previews all the way!