The IDLffShape::PutEntity procedure method inserts an entity into the Shapefile object. The entity must be in the proper structure. For more information on the structure, see Entities.
| Note |
| Note |
Obj->[IDLffShape::]PutEntity, Data
A scalar or an array of entity structures.
None
In the following example, we create a new shapefile, define a new entity, and then use the PutEntity method to insert it into the new file:
PRO ex_shapefile_newfile
; Create the new shapefile and define the entity type to Point.
mynewshape=OBJ_NEW('IDLffShape', FILEPATH('cities.shp', $
SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=1)
; Create structure for new entity.
entNew = {IDL_SHAPE_ENTITY}
; Define the values for the new entity.
entNew.SHAPE_TYPE = 1
entNew.BOUNDS[0] = -104.87270
entNew.BOUNDS[1] = 39.768040
entNew.BOUNDS[2] = 0.00000000
entNew.BOUNDS[3] = 0.00000000
entNew.BOUNDS[4] = -104.87270
entNew.BOUNDS[5] = 39.768040
entNew.BOUNDS[6] = 0.00000000
entNew.BOUNDS[7] = 0.00000000
; Add the new entity to new shapefile.
mynewshape->IDLffShape::PutEntity, entNew
; Close the shapefile.
OBJ_DESTROY, mynewshape
END
Introduced: 5.4