Show / Rename / Delete Related

The idea of related components is to find all components that will need to change if a specific component changes, for example, by being renamed or being deleted.  The Show Related, Rename Related, and Delete Related commands appear in the Project pane when right-clicking a component: they make it easy to find related components, to rename them using a common pattern while updating properties as necessary, and to delete related components.  The Rename Related and Delete Related dialogs show proposed changes in a preview, so we can make adjustments or change or minds before committing any changes.

Components Based on Other Components

One of the most powerful aspects of Manifold is how components can be based on other components.   For example, a map is just a window that includes drawings, labels, or images as layers.  A drawing showing roads might be included as a layer in dozens of different maps.  

 

That is a wonderful thing, but it does mean that if we change the name of a drawing then all maps which use that drawing as a layer must be updated to use the drawing's new name.   Because the map needs to change when the drawing is renamed, we say the map and the drawing are related to each other.  

 

That often involves asymmetric relationships between components, like a map and drawings that are layers in the map.  If we rename a map, we do not need to rename any drawings that are layers in the map.   But if we rename drawings that are used in a map, the names of those layers inside the map's properties must be updated.

 

Another example of an asymmetric relationship is how drawings take the data they display from a table.   Drawings are just viewports that do not themselves contain any data:  a drawing is just a list of properties that say what table to use,  what field in that table contains geometry data,  and what styles to use for display.  

 

That is a very powerful thing as well, because we can have many different drawings, all taking zero space, which show data from the same table in many different ways.  But it also means that if we delete the table that stores data for the drawing, the drawing has nothing to show.  Even if we only rename the table, the drawing's properties must be updated to the new name; otherwise, the drawing will not be able to find the data it is supposed to display. 

 

Projects can have very many components, hundreds of them, which can have dozens of components related to each other.  For example, a table might have dozens of drawings that display geometry from that table, and those drawings might in turn be used in dozens of maps, which in turn might be used in dozens of layouts.   Deleting or renaming that one table could affect very many components scattered throughout the project.  

 

Keeping track of so many relations manually is both difficult and error prone, so Manifold provides handy commands that automatically keep track:  Delete Related, Rename Related, and Show Related.  Those commands appear in the context menu that pops open when we right-click a component in the project pane.  For example, if we right-click a table and choose Show Related, the dialog will provide a list of all related components.  

 

 Illustrations in this topic may be reduced in size to allow more compact documentation display.   Undocked panes can be resized to be larger or smaller, but not as small as the smallest illustrations that may appear.

Example Project

Consider an example project similar to that used in the Raster Paths topic.  The Project pane and windows from the project are shown undocked below:

 

 

The project has an image called Raster, which together with its table Raster Table shows a terrain elevation surface.   The project also includes a drawing called Points that shows the location of eight points in the region.   A labels component called Points Labels shows the height values of those points.    The Raster image, the Points drawing, and the Points Labels layer all appear as layers in a map, called Map, as seen above.

 

 

The Points drawing is a typical drawing, showing data stored in an associated table, called Points table.  The Height field in the table is used for the text shown in Points Labels as labels.

 

 

The project also includes a print Layout, called Layout, which has just a single frame showing the entire Map component, zoomed out to fill the frame.

Show Related

The Show Related dialog provides a simple way to see relationships.  It is a great way to keep projects organized, and to see what components should be Copied together for Pasting into a different project.  For renaming or deletions, we usually will go straight to using the Rename Related or Delete Related dialogs.

 

We can see how various components in the project are related by right-clicking a component and choosing Show Related.

 

 

For example, we can right-click the Points Table component and then choose Show Related.

 

 

The Show Related dialog opens with a list of all components that are related to Points Table, which appears at the top of the list.  All the components in the list, directly or indirectly, depend upon the Points Table.  

 

The drawing refers to the table directly as the table from which the drawing gets its data.   The Points Labels component has an indirect relationship with the table, because Points Labels depends on the Points drawing, which in turn depends on the table.  The Map also indirectly depends on the table, because the Points  drawing is a layer in the map, and that drawing in turn depends on the table.    The Layout, also indirectly depends on the table, because the Map appears as a frame in the layout, and the Map indirectly depends on the table as well.

 

 Those components which directly reference Points Table are marked with a chain icon, to indicate they are closely linked to the table.   In the example above, the Points drawing is the only item in the list marked with a chain icon, because only the Points drawing depends directly upon the table.  

 

  The chain icon appears for all components that directly reference whatever component in the list is marked with the dotted outline cursor, that is, the context item.    We can see relationships for other components in the list by clicking them to choose them.

 

 

If we click the Points drawing, that item is marked by the dotted outline cursor as the context item.   Chain icons appear for both the Points Labels component and also for the Map component, since both of those directly reference the Points drawing, the labels component referencing the drawing as the source of labels, and the map component referencing the drawing as one of the layers in the map.  The Points Table does not reference the drawing (the table doesn't care if there is a drawing that references it), and the Layout references only the Map.  

 

 

If we click the Map to make it the context item, the chain icon appears only for the Layout, because only the layout directly references the Map, as populating one of the frames in the layout.  

Dependencies Reported by Show Related

Show Related reports the following dependencies based on the type of component that was right-clicked:

 

 

Manifold's system for reporting related components is a useful convenience for typical dependencies.  It not designed to discover all possible ways a component might depend on other components.  Some references to names of components are not as direct as the above dependencies, and will not be reckoned by Show Related, Rename Related, or Delete Related, including the following:

 

 

Related Components in Data Sources

Show Related works across all opened data sources, for example, linked databases, linked Manifold .map projects, and so on.  When the list of related components includes components from data sources other than the opened .map file, the components will be sorted by data source, with the innermost data source appearing first.

 

 

Suppose we have a project that links in a Manifold .map project.   The project above has a data source called Mexico, which is a linked Manifold .map project.  The linked project has a Bing data source in it, a Map, and a Mexico drawing and Mexico Table.   We have copied the Mexico drawing in the data source and have pasted it into the main part of the project to create a local drawing called Mexico 2.  This is a way of creating a local drawing that takes data from the Mexico Table in the data source.

 

We right-click the Mexico 2 drawing and choose Show Related.

 

 

The dialog shows related components appearing within the Mexico data source, and it shows the context drawing,  Mexico 2, appearing within the (root) data source, a data source way of saying it is in the local .map project.   In settings that include other data sources, Manifold refers to the local project using (root) data source terminology, to make it clear what is local and what is in an external data source.  

 

The dialog works with components in the external data source just as if they were local.   

 

 For example, if we click the Mexico Table component within the external data source, to make that table the context item, the dialog shows chain icons for both the Mexico drawing within the external data source as well as the Mexico 2 drawing within the local project, since both directly reference Mexico Table.

Renaming Components

There are two ways to rename components.  We can individually rename a component using the usual Windows slow double-click, or we can rename related components all at once using the Rename Related dialog.

 

To rename just one component individually we can slowly double-click it to open the name for editing.

 

 

 

We can then change the name as desired.   Press Enter to accept the edits.  Press Esc to abandon the edits.

 

 

 

Although it usually is a better idea to use Rename Related to rename components, individually renaming components is useful in many cases.   

 

For example, when we want to make many copies of a drawing that all use the same table, we can simply Copy that drawing and then repeatedly Paste it, using Ctrl-C and then Ctrl-V many times.  We can then rename each copy individually to change a series of names for the copies from default names like Drawing 2, Drawing 3, and so on to names that indicate how we intend to style those copies, such as Population, Average Income, and so on.  

 

Tech Tip: Changing the name of just one component can cause trouble for related components.  Change the name of a table that a drawing uses, and that drawing's properties must be updated to the new name.  To do that automatically, use the Rename Related dialog instead of manually renaming with a slow double-click.

Rename Related

The Rename Related context menu command simultaneously accomplishes two renaming functions:  First, if we rename a component the dialog updates the properties of all related components to that new name.  Second, the dialog allows us to rename all related components at once using a common naming pattern.  We can choose which of the related components will be renamed using the new pattern.

 

 

Launch the dialog by right-clicking the main component of interest, and choosing Rename Related.

 

 

The dialog launches with a list of all components related to the context component and to each other.  

 

 

Double-click into a component to rename it.  Enter the new name as desired and press Enter.   For example, in the illustration above we have double-clicked into the Points drawing and have changed the name to Sources.  

 

 

All components in the list will be renamed by default to a pattern based on the proposed new name of the context component.  New names will be shown in blue preview color.  In addition to the drawing being renamed, the drawing's table will automatically be renamed to Sources Table and the labels based on the drawing will be renamed to Sources Labels.  

 

Each component has a box to choose if it will be renamed.  Click a box to toggle it off or on.

 

 

If we click off a box, that component will immediately revert in the preview to the original name.  This allows us to rename some related components but not others, as desired.  In the illustration above, we have clicked the box for the labels component to turn it off, so that component immediately reverts to the original name of Points Labels.  

 

Press Rename to accept changes as shown in the preview, or press Close to abandon any changes.

 

 

The Project pane will be immediately updated with the new names.   Related components that use renamed components will be updated to the new names.  For example, the Points layer in the Map has been renamed to Sources, with the name on the tab in the map's tab strip being updated accordingly.

 

 

All properties involved in the changes are automatically updated as well.  If we right-click onto the Sources tab in the map and choose Properties, to open the Properties dialog for the Sources drawing, we can see that the Table property, which specifies what table the drawing uses as a source for data, has been updated to the new name of the table, Sources Table.

Use Rename Related with Individual Components

It is usually good practise to use Rename Related to rename individual components, in preference to the usual Windows move of a slow double-click to rename just one component.   Why?  Because a Windows-style slow double-click only changes the name of that one component, but it does not  automatically change references to that name in the properties of other components which may depend upon the renamed component.    In contrast, if we use the Rename Related command to rename a component, that will automatically update any references to that name in the properties of other components.

 

 

Suppose we right-click on Points Table and choose Rename Related.

 

 

To change only the name of that one component, in the Rename Related dialog we click off the boxes for the Points drawing and for Points Labels.   We can then double-click into the Points Table item and enter a new name.

 

We change the name to Observations Table.  No other component is renamed, since their boxes are off.    We press Rename.

 

 

Immediately the table is renamed, just as if we had renamed it with a Windows-style slow double-click.    However, in addition to the name change, references to that table in related components have been updated to the new name.

 

 

For example, if we open the Properties for the Points drawing, we can see that the Table property has been updated to Observations Table.  

 

Advice - A slow double-click on a component, entering the new name, and pressing Enter is quicker than a right-click, choosing from a context menu, double-clicking / renaming in the dialog, and then pressing Rename. But doing that is risky in projects that have many components.  A component that uses the item we are renaming might be out of sight in a folder.  We might think  that a drawing does not appear in any maps we don't know about, but it might appear as a layer in a map somewhere. We might have forgotten the component we are renaming is used to create labels, or appears in a layout frame.   Without using tools like Show Related we will not know.   

 

It is usually quicker overall to just get into the habit of using Rename Related to rename even single components.  That is one of those clean-living habits that help keep large projects well organized.

Rename Related Across Data Sources  

Rename Related works across all opened data sources that allow renaming of the components within, for example, linked databases, linked Manifold .map projects, and so on.  Related components will always be shown, and those in data sources which allow renaming will have their on/off boxes turned on by default.   Data sources that are read-only will have renaming disallowed for components in those data sources.

 

When the list of related components includes components from data sources other than the opened .map file, the components will be sorted by data source, with the innermost data source appearing first.

 

 

Consider the example project containing a Mexico data source linked from a Manifold .map project, that appeared in illustrations earlier in this topic with Show Relations.  We right-click on Mexico 2 and choose Rename Related.  

 

 

The Rename Related dialog shows on boxes for the drawing and table within the data source, indicating they can be renamed.  

 

 

Suppose our drawings of Mexico only contain the province of Durango as our area of interest.   We double-click onto Mexico 2 and change the name to Durango.  

 

 

The dialog updates the names of related components within the external data source as well, and shows the proposed changes in blue preview color.  It is OK that there are two drawings named Mexico, one in the local project and one in the external data source, because they are disambiguated by their full names, with the full name of the drawing in the data source being [Mexico]::[Durango].     If we like what we see for the proposed renaming, we press Rename to commit the changes.

 

 

Rename Related swings into action and renames components as we have directed, automatically updating all references within component properties.   Note that an asterisk * character appears in the cylinder icon for the Mexico data source, indicating it has not been saved.   To save changes to a nested Manifold project, just like saving changes to the local project with which we are working, we have to save the local project.    See discussion in the Example: Closing without Saving topic.

 

 

If we pop open the Properties dialog for the Durango drawing in the local project, we see that the Table property for it has been updated to using the new name of the table in the external data source.

 

When linking a Manifold .map project, we are working with Manifold's native data storage technology, so everything works as if components in the linked .map project were in the local project.  However, many data sources support renaming of components within the data source.  

 

 

For example, suppose we have an analogous project, where we have linked in a PostgreSQL / PostGIS database.   Within that database we have saved our sample Mexico drawing, as shown in the Connect to PostgreSQL  topic.  In our project above, we have copied the public.Mexico drawing from the Postgres data source (which is not shown in expanded form, since it has very many components in it) and have pasted it into the local project.   The public.Mexico drawing in the local project thus takes its data from the corresponding table in the external Postgres data source.

 

We right-click on public.Mexico and choose Rename Related.

 

 

The dialog shows us related components within the external database.  

 

 

If we rename our local drawing Durango, the dialog will preview in blue color proposed new names for related components within the Postgres data source.   If we agree, we press Rename.  

 

Manifold uses the same logic for Rename Related as used in the Project pane for renaming components within data sources.  If we attempt to use names disallowed by the external DBMS, such as characters not allowed in the DBMS for names, those names will automatically be adjusted as part of Manifold's negotiation with the database for new names.  The new names therefore will not break any links, but they may be slightly different than the names shown in the preview.

 

Not all data sources allow renaming of components.   For example, the names of components within data sources that are shapefiles are the names of the files, which cannot be renamed on the fly.

 

 

Suppose we have a project where we have used File - Link to link in a shapefile as a data source.  We have called the data source buildings shapefile.  In Manifold, a linked shapefile exposes its contents as a drawing and a table, called buildings and buildings Table, with Manifold's shapefile dataport striving mightily to provide a common, familiar interface to what is in the shapefile.    We have copied the buildings drawing in the shapefile and have pasted it into the local project, creating a drawing in the local project called buildings, which takes its contents from the buildings Table within the shapefile.

 

We right-click the buildings drawing in the local project and choose Rename Related, to see what happens.

 

 

The Rename Related dialog shows both components within the external shapefile data source as related components, but both have off boxes, indicating they cannot be renamed.   The dialog is happy to show us the dependencies, and it is happy to rename the buildings drawing in the local project for us, but it cannot rename the components in the shapefile, since that is not supported by shapefile data sources.

Renaming the Results of Copy / Paste

A frequent use for Rename Related is to rename the results of Copy and Paste operations.

 

 

Suppose we would like a copy of a drawing and the drawing's table.  We can Ctrl-click both to highlight them and then press Ctrl-C to Copy them to the Clipboard.   We can then press Ctrl-V to Paste.  Manifold will add a postfix, the number 2 to the names of the copied components thus created.

 

 

We can right-click one of the pasted components and choose Rename Related.

 

 

The dialog shows only the two pasted components as related components, since we have made a fresh copy of the table, and the pasted copy of the drawing depends only upon the pasted table.  Manifold automatically maintains such relationships when pasting such copied ensembles.

 

 

We double-click into the Points 2 drawing item and change the name to New Points.  

 

 

The Rename Related dialog is smart enough to understand that the 2 numbers were used as postfixes and need not be preserved, so it proposes new names without retaining the postfix numbers.    We press Rename.

 

 

The pasted components are renamed to the new names we prefer.    Rename Related is a convenience and is not a perfect instrument, but it is very useful in typical workflow.

Delete Related

The Delete Related command works very much like the Rename Related command, except that it deletes related components that have their boxes checked.  The Delete Related dialog also shows only those components that are so closely related that deleting one of them in most cases would also necessarily or logically call for deleting the others.

 

 

Consider our example project, as expanded by copying the Points components to create New Points components.   In the map window seen at above right, we now use the New Points Labels and New Points drawing as layers.

 

 

We right-click on the New Points drawing and choose Delete Related.

 

 

The Delete Related dialog lists the table, the labels component and the drawing for deletion.   Those are so directly related that deleting one of them often involves a desire to delete all of them.   The dialog does not list the Map, because deleting either the New Points drawing or New Points Labels at most will only delete a layer from the map, without any compelling need to delete the map.   For example, we might want to delete these New... versions we have created and go back to using the original Points... versions.

 

Within the list, the dialog tries to apply logic that helps us in most situations.   For example, if we choose to not delete something by unchecking its box,, then automatically those components that likewise might not be necessary to delete will also be unchecked.

 

 

Suppose we click on the box for the New Points drawing in the list, to uncheck it and thus indicating it should not be deleted.  

 

 

The dialog will automatically uncheck the box for the New Points Table as well, since we usually would not want to not delete the drawing but to delete the table which the drawing requires.

 

The dialog applies analogous logic to delete those components that logically would be deleted together in most cases.

 

 

Suppose all of the boxes in the list are not checked, so that no components will be deleted.   We then click the New Points Table box to check it and to mark that component for deletion.

 

 

The dialog will automatically also check all the other boxes, since if the table is deleted the drawing will be empty and thus the labels will be empty as well.  In most cases, if we want to delete related items and we delete the table, we will want to delete the drawing and the labels that use that table as well.

 

Notes

MFD_ is reserved - All names starting with mfd_ (case not significant) are reserved for use by the system.  Names for fields, indexes, constraints, tables, components other than tables, properties... everything. Do not name anything beginning with mfd_ or MFD_ or in any upper or lower case combination of those characters.   mfd_id is a reserved name for a field in tables, to be used only for the identity field that Manifold maintains as an automatically unique value field.

 

Deletions are Confirmed - Deleting components in the Project pane displays a confirmation dialog. The default button in the confirmation dialog is set to Cancel.  If we do not want to see the confirmation dialog, we can check the Never show this again box.    Another way to eliminate the confirmation dialog is to uncheck the Confirm deleting components box in the Tools - Options dialog.

See Also

Getting Started

 

User Interface Basics

 

Project Pane

 

Drawings

 

Images

 

Tables

 

Maps

 

Layouts

 

Example: Project Pane Tutorial - In this example we take an extended tour of the Project pane, engaging in a variety of simple but typical moves that are illustrated step by step.