Purpose
Fits objects to its neighboring objects; corresponds to choosing Spatial > Edit > Fix/Clean > Fit Objects. This function requires the MapCAD Tool and can be executed via the Exec() command. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Exec("MapCAD.mbx","FitObjects",Tolerance, DistanceUnit, ReferenceLayer, AddNodes)
Return Value
Logical If an object cannot be fitted or the function failed, the return value=FALSE.
Description
Use the FitObjects function to fit all selected objects to their neighboring objects in a reference layer. Each selected object is considered, node by node, with neighboring nodes and edges from reference objects.
If close to the source node a reference node is found, the source node is moved to the reference node. If close to the source node a matching edge (without nodes) is found, the source node is aligned to the reference edge. In addition, a new node can be inserted into all found reference edges at the matching point.
Parameters | Description |
---|---|
Tolerance | Float value, circle radius around each node to search for matching reference object nodes and edges. |
DistanceUnit | String value, distance unit for geographic operations (e.g., "mi") according to the Set Distance Units statement. |
ReferenceLayer | String value, layer name of the layer that contains the neighboring objects. |
AddNodes | Logical value, If TRUE and the reference layer is writable, new nodes are inserted into all found reference edges at the match point. |
Examples
'Fit all selected objects to its neighboring objects in layer Lakes.
'The maximum distance between the nodes or edges is 0.03 miles.
'New nodes are inserted at the matching points into all reference edges.
Dim Result as logical
Result = Exec("MapCAD.mbx","FitObjects",0.03,"mi","Lakes","T")