The Reshape template appears in the template list when a geometry field, of type geom, geommfd, or geomwkb, has been picked in the Transform pane. It alter the shape or location of objects.
Reshape |
Alter the shape of objects using the specified operation and parameters, and save into the specified Result destination using the specified geometry type. Z values are preserved and 2D curvilinear segments are preserved, but 3D curvilinear segments are replaced with 3D straight line segments. Options in the Operation box are:
Launch the template by choosing a geometry field and then double-clicking the Reshape template. When the template launches we can specify options.
|
Reshape : flip horizontal
Reshape: flip vertical |
The Reshape template using flip horizontal or flip vertical options flips objects horizontally or vertically around the centroid of each geom and saves the resulting geometry into the specified Result destination.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the flip horizontal option. We choose New Field and specify flip horiz for the new geometry field. We specify the name Flip Horizontal for the drawing that will display that field. Press Transform.
A new Flip Horizontal drawing appears in the Project pane. We drag and drop the new Flip Horizontal drawing as a layer into the Objects Drawing window.
Areas and lines are flipped mirror image left/right about their centroids. Points are unchanged.
The flip vertical option works as we might expect:
Repeating the transform with the flip vertical operation and a different Result field and drawing, we get the following result:
Areas and lines are flipped vertically up/down about their centroids. Points are unchanged.
If we would like to flip objects both horizontally and vertically, we can start with one of the flipped versions, such as the horizontally flipped version, and then choose the other flip operation, such as a vertical flip.
In the Transform pane seen above we have chosen the flip horiz field previously created in this example, which contains the original geometry flipped horizontally. We apply the flip vertical operation to that field to flip the geometry vertically as well. We choose flip both as the name of a new Result destination geometry field, and Flip Horiz and Vertical as the name of the new drawing. Press Transform.
The result shows what the original objects look like with both horizontal and vertical flipping applied. Z values are preserved and 2D curvilinear segments are preserved, but 3D curvilinear segments are replaced with 3D straight line segments.
flip horizontal and flip vertical internally use the GeomFlip SQL Function to flip individual objects while keeping them centered at the same position.
|
Reshape: reverse |
Takes lines and areas and reverses the order of coordinates defining the line, and places the result in the Result destination. Points and areas are copied unchanged. Preserves curvilinear segments and Z values.
Given a version of our sample drawing Styled to show arrow heads at the ends of lines, we select the two line objects.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the reverse operation. We choose Same Field as the Result destination, which will reverse the lines "in place" within the same geometry field. We check the Transform selection only box so only the two selected lines will be reversed.
Press Transform.
The two selected lines immediately reverse their direction, while area objects, not being selected, will be unchanged. Points also are unchanged.
If we forget to check the Transform selection only box, the transform will be applied to all line objects, with no effect on points and areas.
The result is the same, since in this example there were only two lines and both were selected, so the result is the same whether the Transform selection only box is checked or unchecked.
|
Reshape : rotate |
Rotate objects in the source field about their circle centers to the specified clockwise angle and put the result into the Result destination.
We begin with the sample drawing.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the rotate operation, using 45 as the angle and Degree as the unit of measure. We choose New Field as the Result destination, specifying Rotated Geom as the name of the new geometry field, and Objects rotated as the name of the new drawing to be created to visualize that new geometry field.
Press Transform.
A new Objects rotated drawing appears in the Project. We drag and drop that as a new layer into the Objects Drawing window. We style the new layer using a contrasting color. Using the Layers pane we reduce the opacity of the lower layer slightly so the objects in the upper layer can be seen more clearly.
All of the areas and line objects are rotated 45 degrees clockwise about their centers. We can see from the relative positions and relative rotations of the objects that it is not the drawing itself which is rotated but that each individual object is rotated about its center. The positions of the centers of object relative to the centers of other objects are not changed.
Z values are preserved and 2D curvilinear segments are preserved, but 3D curvilinear segments are replaced with 3D straight line segments.
Note that the GeomRotate SQL function use internally by this transform operation rotates objects counterclockwise. The template changes the sign of the Angle parameter value before passing it to the function, so the template can use the more conventional, non-programmer clockwise sense of rotation used by most graphics and CAD editor user interfaces.
|
Reshape : scale |
Scale objects by the given scale value around the circle centroid of each object and put the result into the Result destination.
We start with the sample drawing.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the scale operation, using .8 for both X scale and Y scale. We choose New Field as the Result destination, specifying Scaled Geom as the name of the new geometry field, and Objects scaled as the name of the new drawing to be created to visualize that new geometry field.
Press Transform.
A new Objects scaled drawing appears in the Project. We drag and drop that as a new layer into the Objects Drawing window. We style the new layer using a contrasting color. Using the Layers pane we reduce the opacity of the lower layer slightly so the objects in the upper layer can be seen more clearly.
Applying Scale with an X scale value of .8 and a Y scale value of .8 reduces the size of all objects to 80% of the former size. Points are unchanged.
We re-run the transform with different settings:
We alter the scale values to 1.2 for both X and Y, and for the Result we choose the Scaled Geom field we created in the prior operation. Press Transform.
The Objects scaled drawing instantly updates, since it shows whatever is in the Scaled Geom field. In the illustration above we have reduced opacity of the Objects scaled layer to 80%, so objects in the layer below can be seen if they are completely covered by objects in the layer above.
Applying Scale with a Scale X value of 1.2 and a Scale Y value of 1.2 increases the size of all objects by 20%.
Z values are preserved and 2D curvilinear segments are preserved, but 3D curvilinear segments are replaced with 3D straight line segments.
|
Reshape : shift |
Add to or subtract from coordinate values in the source by the given values for a shift in the X direction and in the Y direction and put the result into the Result destination.
We select two objects in the sample drawing.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the shift operation, using 100 for X and 0 for Y and choosing Meter as the unit of measure. We choose New Field as the Result destination, specifying Shifted Geom as the name of the new geometry field, and Objects shifted as the name of the new drawing to be created to visualize that new geometry field.
Press Transform.
A new Objects shifted drawing appears in the Project. We drag and drop that as a new layer into the Objects Drawing window. We style the new layer using a contrasting color.
The Objects shifted drawing shows how the two selected objects would be moved 100 meters to the right.
Z values are preserved and 2D curvilinear segments are preserved, but 3D curvilinear segments are replaced with 3D straight line segments.
|
Reshape : smooth |
A template to simplify lines and areas by using fewer coordinates to represent approximately the same shape. Replaces coordinates in lines and areas the source field to smooth out apparent curves based on the specified Tolerance factor and saves the result to the specified Result destination. A better name might be a simplify function as many coordinates used to provide convoluted lines are reduced into fewer coordinates that provide simpler lines.
We will use a sample drawing shown streams in Australia. The width of the view is approximately 7 kilometers.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the smooth operation, using 50 for the Tolerance factor, and choosing Meter as the unit of measure. We choose New Field as the Result destination, specifying Smoothed Geom as the name of the new geometry field, and Smoothed streams as the name of the new drawing to be created to visualize that new geometry field.
Using a Tolerance of 50 means that coordinates closer to each other than 50 meters will be collapsed into a single coordinate, reducing the number of coordinates used to draw each line.
Press Transform.
A new Smoothed streams drawing appears in the Project. We drag and drop that as a new layer into the Streams window. We style the new layer using a contrasting color.
The preview shows the result of Smooth applied to objects in Geom using a Distance of 50. The river lines are visibly less smooth curves, for example, in the upper right part of the window.
We re-run the transform with a larger Tolerance setting.
We alter the Tolerance setting to 100, and for the Result we choose the Smoothed Geom field we created in the prior operation. Press Transform.
The Smoothed streams drawing shows whatever is in the Smoothed Geom field, so it shows the result using a Tolerance of 100. River lines are even more obviously composed of straight segments.
We re-run the transform with a Tolerance setting of 200.
The bigger the distance, the more simple the lines. Using a Tolerance of 200, the lines have become too simplified to connect with other lines in some cases.
|
Reshape : snap to grid |
Move all coordinates in the source field to orthogonally distributed grid locations with the specified X step and Y step distances between them and place the results in the specified Result destination. Any coordinates that end up the same are collapsed together into a single coordinate.
We will use a sample drawing shown streams in Australia. The width of the view is approximately 7 kilometers.
With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Reshape template.
In the Reshape template we choose the snap to grid operation, using 200 for both X step and Y step, and choosing Meter as the unit of measure. We choose New Field as the Result destination, specifying Snapped Geom as the name of the new geometry field, and Snapped streams as the name of the new drawing to be created to visualize that new geometry field.
Press Transform.
A new Snapped streams drawing appears in the Project. We drag and drop that as a new layer into the Streams window. We style the new layer using a contrasting color.
The projection is meter-based so using steps of 200 means snapping vertices to a 200 meter by 200 meter grid. The Snapped streams drawing shows how vertices of the lines are moved to grid locations, so line segments become straight lines between locations on an orthogonal grid.
For an even more pronounced orthogonal lines effect, we re-run the transform using a larger step for X and Y:
We alter the X step and Y step settings to 600 meters, and for the Result we choose the Snapped Geom field we created in the prior operation. Press Transform.
The Snapped streams drawing shows whatever is in the Snapped Geom field, so it shows the result using X step and Y step settings of 600 meters. River lines are even more obviously composed of straight segments.
The small dots on lines near the right side of the display show groupings of redundant coordinates, which can be removed with a quick Clean : normalize metric operation.
To understand how Snap to Grid works we can work with a drawing that shows the province of Durango in Mexico using Orthographic projection, which is true to scale and uses meters as the unit of measure.
Suppose we overlay a grid of points with a point located every 50000 meters in X and Y directions.
Applying snap to grid to the area using X step and Y step settings of 50000 meters tells Manifold to move the coordinates that make up the area to the nearest point location.
The result is to move defining coordinates to locations where the lines between them are all vertically or horizontally straight lines or straight diagonal lines between grid locations. Most redundant coordinates will be eliminated. It is possible, however, that some redundant coordinates will be left, in which case a quick Clean : normalize metric operation will remove them.
Z values are preserved but curvilinear segments are replaced with 3D straight line segments.
|
Reshape : unscale |
Inverse of the scale operation. Using scale with X and Y scale values of .5 will reduce objects to half size. Using unscale with X and Y scale values of .5 will expand those reduced objects to their original size.
|
Curvilinear segments - As a practical matter, most people doing GIS will use straight line segments for lines and areas. Few GIS systems do a good job of supporting curved segments, so there is much less data published using curved segments. Manifold's ability to work with curved segments allows us to use that data within Manifold in a limited way, at least for display and interactive editing.
However, most processing tools in Manifold, such as Transform templates and various Geom SQL functions, do their work by first converting a curvilinear segment into a straight line segment between the same two start and finish coordinates. That will often lead to weird or otherwise unexpected results. To avoid such problems, first convert curvilinear segments into equivalent constellations of straight line segments at whatever resolution is desired, using the Clean transform template with the convert curves to lines operation option and the number of linear segments desired to approximate the curve in the Curve limit parameter. See the Curved Segments discussion in the Drawings topic.