VS:DTM6 GetZatXY: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
(No difference)
|
Latest revision as of 14:29, 12 August 2013
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Calculates the elevation of the specified 2D point on the specified Site Model object.
FUNCTION DTM6_GetZatXY(
hDTMObject :HANDLE;
TINType :INTEGER;
x :REAL;
y :REAL;
VAR outZ :REAL) :BOOLEAN;
def vs.DTM6_GetZatXY(hDTMObject, TINType, x, y): return (BOOLEAN, outZ)
Parameters
hDTMObject HANDLE A handle to a Site Model object. TINType INTEGER A number identifying the Site Model surface (existing or proposed) which elevation is to be calculated. x REAL coordinate of the 2D point which elevation is to be calculated. y REAL coordinate of the 2D point which elevation is to be calculated. outZ REAL Output parameter. The calculated elevation.
Return Value
Returns TRUE if the 2D point falls inside the Site Model surface and the elevation was calculated.
Remarks
The values of TINType are one of:
- 0 - existing - calculates the Z elevation of the point on the existing surface
- 1 - proposed - calculates the Z elevation of the point on the proposed surface
- 2 - current - depends on the 2D and 3D display parameter of the Site Model. If either of them is proposed then this mode works as '1' otherwise it works as '0'
- The logic is:
- IF (2DDisplay == Proposed) OR (2DDisplay == ExistingOrPoposed) OR (3DDisplay == Proposed) THEN GetZ from [Proposed Surface]
- ELSE GetZ from [Existing Surface]
Example
VectorScript
PROCEDURE Example; VAR hDTM :HANDLE; hPoly3D : HANDLE; x :REAL; y :REAL; z :REAL; result :BOOLEAN; BEGIN Poly(0,0,-0.5,1,0.5,1.5,2,1,1,-0.5); hPoly3D := LObject; hDTM := DTM6_GetDTMObject(ActLayer, True); IF DTM6_IsDTM6Object(hDTM) AND DTM6_IsObjectReady(hDTM) THEN BEGIN IF DTM6_IsTypeVisible(hDTM, 4{is existing visible in 3D}) THEN BEGIN result :=DTM6_GetZatXY(hDTM, 0{Existing}, x, y, z); result :=DTM6_SendToSurface(hDTM, hPoly3D, 0{Existing} ); END else BEGIN result :=DTM6_GetZatXY(hDTM, 1{Proposed}, x, y, z); result :=DTM6_SendToSurface(hDTM, hPoly3D, 1{Proposed} ); END; END; END; RUN(Example);
Python
def Example(): vs.Poly(0,0,-0.5,1,0.5,1.5,2,1,1,-0.5) hPoly3D = vs.LObject() hDTM = vs.DTM6_GetDTMObject(vs.ActLayer(), True) if vs.DTM6_IsDTM6Object(hDTM) and vs.DTM6_IsObjectReady(hDTM): if vs.DTM6_IsTypeVisible(hDTM, 4): result, z = vs.DTM6_GetZatXY(hDTM, 0, x, y) result = vs.DTM6_SendToSurface(hDTM, hPoly3D, 0 ) else: result, z = vs.DTM6_GetZatXY(hDTM, 1, x, y) result = vs.DTM6_SendToSurface(hDTM, hPoly3D, 1) Example()
Version
Availability: from All Versions
This is drop-in function.
See Also
VS:DTM6_GetDTMObject | VS:DTM6_IsDTM6Object | VS:DTM6_IsObjectReady | VS:DTM6_IsTypeVisible
[[VS:DTM6_GetDTMObject]] | [[VS:DTM6_IsDTM6Object]] | [[VS:DTM6_IsObjectReady]] | [[VS:DTM6_IsTypeVisible]]