Example: Draw Lines, Areas and Points

In this example we create points, lines and areas in a drawing.   Choose File - Create - New Drawing to create a new, blank drawing.   

 

 

That creates a new blank drawing, called Drawing, that stores geometry in a table called Drawing Table which has two fields, an mfd_id field to use in a spatial index and a Geom field to host any geom data.   As we add objects to the drawing a new record will be added to this table for each new object where the geom contains the geometric data defining the object.

 

Open the drawing by double-clicking on Drawing.

Choose a Create Mode

 The default mouse cursor mode is navigation.   

 

 

The drop-down menu on the mode button lets us choose a different mode, such as creating areas, lines, or points.

 If we choose Create Point the mouse cursor user interface switches from Navigation mode into Create Point mode.

 

 

The mode button always shows what mode applies for that window.   Hovering the mouse over the mode button will show a tooltip.

 

Different windows can have different modes, with one window being in Create Line mode while another window stays in Navigation mode.  As we switch between windows the mode button will automatically switch to show the mode for that window.

Snap Modes

Snapping jumps the mouse cursor directly to a desired location, like a point or the end of a line, when the mouse cursor moves near that location.  That makes it easy to exactly click a desired location just by moving the mouse cursor approximately nearby.    We can also use snap modes to constrain mouse cursor motion to specified grid locations or to bearings, such as only horizontal or vertical motions.  

 

 Snap mode is indicated with a blue box cursor that snaps to locations allowed by the snap mode.  Snapping is off when we first launch a new Manifold session, and then stays off or on depending on how we last toggled it in that Manifold session.    Snapping status is a common setting between the path tool and editing commands, so if in the path tool or while editing we have last turned snapping off, or we have changed the snapping mode, it will stay off or stay in the new mode until we turn snapping back on or change to a different mode.

 

When in edit mode, the Spacebar is a keyboard shortcut that toggles snapping on and off.   We also can toggle snapping on and off when in edit mode by right-clicking into the drawing and choosing Snap from the context menu.  The right-click context menu also allows us to switch snap modes, from the default snapping to nearby vertices to other snap modes.    See the Snap Modes topic for full information, keyboard shortcuts, and examples.  

 

 By default, snapping works only with objects in the active layer.  If we uncheck the Snap to Active Layer Only choice in the right-click context menu, then snapping will work for all visible layers which have snapping enabled in the Layers pane.

 

Snapping might be confusing for beginners when first learning how to create lines and other objects.  If the mouse cursor is jumping to objects and vertices nearby instead of allowing us to click where we want, right-click and see in the context menu if snapping is on.   If snapping is on, turn it off if snapping is not desired.   When editing or using the path tool, we can toggle snapping off and on by pressing the Spacebar.

Example: Create Points

 

 Choose Create Point in the mode button to start adding points.  

 

 

 

Each time we Click a new previewed point appears, marked with a small, blue box icon to indicate what we see is just a preview until we commit the edits.   In this example we will create four new points.

 

 

When we are ready to commit the edits, that is, to actually add points to the table and thus to the drawing, we right-click anywhere in the drawing.

Choose Save Changes in the context menu to create four separate point objects at the locations clicked.  Ctrl-Enter is a keyboard shortcut for the same thing.

 

If we like and we are in the mood to create bizarre geometries that will puzzle future users, we can shift-right-click to create a multipoint, that is a branched point object that looks like four separate points but is really only a single point objects.  

 

If we change our minds about adding the points that are previewed with blue boxes we can press Ctrl-Backspace, or right-click and choose Undo Changes from the context menu, or switch to a different layer.

 

The four new points are created in the drawing.

 

 

What that means in reality is that four new records have been added to the table: the drawing just visualizes those records.  The geom value for each record defines the location of the point.

 

If we wanted to create additional points in the drawing we could continue to do so by clicking in the drawing so long as the Create Point button in the toolbar is active.   When creating points in a drawing, users will strike a balance between how many points they want to click before they decide to right-click to create those points.  It is not efficient to right-click after every point, but at the same time we probably wouldn't want to click hundreds of points before we right-click to commit changes.

 

Attributes - When creating many points at once, whatever field values we enter into the Record pane's Values tab will be used for all the points so created.   If we want to create points with different field values, then after clicking once to create a point, we enter the attribute values desired and then Save Changes or press Ctrl-Enter to create that point.  That allows us to create points with different attribute values for each point.

Example: Create Lines

See the Editing Drawings - Create Lines with Curves video for a live action example.

 

 

 Choose Create Line in the mode button to start adding lines.  We will create one new line in the drawing.

 

As we begin clicking into the drawing to create a line, each time we click a blue box appears to show the coordinate of the line that is created.   A blue line extends between the coordinate locations and to the mouse cursor to preview the shape of the line.

 

 

As we continue clicking the line grows.   What we see is just a preview until we commit the edits.

To commit the edits, that is, to create the line, we right-click anywhere in the drawing.  The blue line extending to the cursor will be ignored when we right-click.  

Choose Save Changes in the context menu.   Pressing Ctrl-Enter is a keyboard shortcut to commit changes.  

 

If we change our minds about adding the line that is previewed in blue color, instead of choosing Save Changes we can press Ctrl-Backspace, or right-click and choose Undo Changes from the context menu, or switch to a different layer.

 

The new line is created in the drawing.

 

 

As with the creation of points, what that really means is that a new record has been added to the table.  The new record contains a geom that stores the geometry for the line.  

 

If we wanted to create additional lines in the drawing we could continue to do so by clicking in the drawing so long as the Create Line button in the toolbar is active.    Note that the creation of lines is different than the creation of points in that we can create many points by clicking many times and then pressing right-click just once to create all of the previewed points at once.   In contrast, when creating lines we create them one at a time.   

 

A Fast Way to Create Straight Lines - Once we choose the Create Line tool we can very rapidly create straight lines one after the other:  For each line, click the start, click the end, and press Ctrl-Enter.  Move on to the next line.   Experienced users will take advantage of keyboard shortcuts

Example: Create Areas

See the Editing Drawings - Create Areas  video for a live action example.

 

 

 Choose Create Area in the mode button to start adding areas.  We will create one new area in the drawing.

 

As we begin clicking into the drawing to create an area, each time we click a blue box appears to show the coordinate for the area that is created.   A blue line extends between the coordinate locations and from the first location clicked to the mouse cursor to preview the shape of the area.

 

 

 

As we continue clicking the area grows.   What we see is just a preview until we commit the edits.

 

 

 

We click one more time to indicate the last coordinate that will define our area.

 

 

To commit the edits, that is, to create the area, we right-click anywhere in the drawing.   The blue line extending to the cursor will be ignored when we right-click.  

Choose Save Changes in the context menu.  Pressing Ctrl-Enter is a keyboard shortcut to commit changes.  

 

If we change our minds about adding the area that is previewed in blue color, instead of choosing Save Changes we can press Ctrl-Backspace, or right-click and choose Undo Changes from the context menu, or switch to a different layer.

 

 

The new area is created in the drawing.

 

 

As with the creation of lines and points, what that really means is that a new record has been added to the table.  The new record contains a geom that stores the geometry for the area.  

 

To add areas which contain "holes" or "islands" see the Example: Create an Area with Holes and Islands topic.

Switch Back to Default Navigation Mode

 After creating areas, lines, or points, switch the mouse cursor mode back to default navigation mode.   Click the cursor mode button and choose Default.   Pressing Shift-Esc is a keyboard shortcut to get back to default navigation mode.

 

 

There is no harm done if we forget, since immediately any cursor clicks in the active window will begin to create whatever object had been previously created.  We can press Ctrl-Backspace or Right-click and choose Undo Changes to abandon the edits, and no object will be created.

 

Notes

Committing or abandoning changes - When creating objects and we are ready to create those objects, we, right-click anywhere in the drawing and choose Save Changes from the pop-up menu to commit changes, or we press Ctrl-Enter, or we press the Add Record button in the Coordinates tab of the Record pane.  To abandon changes, we can press Ctrl-Backspace, or right-click and choose Undo Changes from the context menu, or switch to a different layer.

 

Drawings must be writable -  To create objects in a drawing that drawing cannot be read-only.   That means:

 

 

The first requirement may seem painfully obvious, but it is easy to forget we might have added a data source in read-only mode.   Read-only data sources will have a small black lock as part of their icons.  

 

Also to consider are more sophisticated data sources, such as databases, where the individual drawings and other data within them might be subject to various access controls where different users have different permissions for different items, with some drawings or tables being read-only and others not.

 

The spatial index requirement is easy to take for granted because Manifold will automatically create spatial indices on drawings that have been imported from various GIS formats or that we create using a New Drawing menu.  But if we have created a drawing using a query we might have forgotten to create it with a spatial index.   That is easy to fix.

 

Clicking on whole number coordinates - Sometimes when creating objects in drawings, or labels in a labels component, for example, when using Manifold as a CAD editor or using Manifold to create diagrams for illustrations, we would like the coordinates we click for objects to be whole numbers, such as X,Y values of -165, 40 and not -165.4954783999, 40.9398312223.   

 

There are two ways to accomplish clicks on whole number coordinates.   The best explicit way is to use snap modes and use Snap to Grid to snap to the virtual grid that can be turned on in the Layers pane.  Set the Step value for the grid to be some reasonable even number.  Adjust the Step value by double-clicking on the Grid virtual layer in the Layers pane, to launch the Grid dialog that is used to customize grid settings.   A Grid step value of 1, as used in this example, will limit mouse clicks to only those grid locations that are round numbers of the unit of measure, with no digits to the right of the decimal point.

 

Another way, less elegant, to click on whole number coordinates is to first choose View - Zoom to Native before we begin clicking to create objects.  That adjusts the scale in use so that each pixel on screen that can be clicked corresponds to a whole number coordinate value.   That works for either standalone drawing or label windows or for drawing or labels layers in a map window.

Videos

Editing Drawings - Create Areas - How to create areas (polygons) in a drawing.  We digitize a lake by tracing over a background satellite image layer from a web server.  This quick video shows how editing tools in Manifold make it easy to digitize objects very quickly, correcting any errors with no stress or fear of getting it wrong.  Includes a quick demo of snapping.

 

Editing Drawings - Create Lines with Curves - A very short video showing how to create lines in drawings using straight segments and also circular arcs.  We create a line in a map of Paris showing our walk around circular ponds. Manifold can create polylines using straight line segments for classic polylines, or using curved segments that are circular arcs, ellipses, or splines for very smooth curves, a much faster and easier technique than clicking many points.  Super!

 

See Also

Editing Drawings

 

Example: Add a Spatial Index to a Table - How to create a spatial index in a table.

 

Example: Drawings use Geom Fields in Tables  - An essential discussion on how drawings are created from geom fields in tables, including how the drawing knows which coordinate system to use.

 

Example: Create a Line using the Info Pane - Step by step creation and modification of a line in a drawing using the Info pane Coordinates tab.

 

Example: Create an Area with a Hole - Create an area in a drawing where the area includes one or more holes.  This is similar to how we create areas that have islands as part of the area.   

 

Example: Create an Area with Holes and Islands - Create an area in a drawing where the area includes holes and also islands.

 

Example: Create a Multipoint - How to create multipoints.

 

Example: Change the Shape of Areas - Step-by-step editing of an existing area in a drawing: changing the shape by moving a vertex, by moving several vertices together, by moving the entire object, by deleting a vertex and by adding a vertex.

 

Example: Edit Areas in a Layer to Align with Another Layer - Editing areas in one layer so their boundaries align, either all or in part, with boundaries of areas in a different layer is a common task in GIS and CAD. For example, we might want area boundaries in a layer with different zoning areas for tax or regulatory purposes to be guided by the boundaries of administrative jurisdictions, such as the boundaries of cities, in a different layer.  This example shows how, using fast and simple techniques.  

 

Example: Edit Covered Objects - Working with drawings where 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.