CREATE OR REPLACE Type Body st_geometry AS
constructor Function st_geometry (geom_str clob, srid number)
Return self AS result
IS
temp varchar2(1);
tempraw raw(1);
entity number;
geom_type number;
name varchar2(32);
spref_r SDE.st_spref_util.spatial_ref_record_t;
shape SDE.st_geom_util.shape_r;
is_empty boolean := False;
rc number;
buffer clob;
Begin
geom_type := SDE.st_geom_util.unspecified_type;
buffer := geom_str;
SDE.st_geom_util.get_type(buffer,entity,geom_type,is_empty,SDE.st_geom_util.st_geometry_type);
If entity = SDE.st_geom_util.sg_illegal_shape THEN
raise_application_error (SDE.st_type_util.st_geometry_invalid_type,'ST_GEOMETRY type must be a geometry type.');
End If;
SDE.st_geom_util.get_name(entity,name);
spref_r.srid := srid;
rc := SDE.st_spref_util.select_spref(spref_r);
If rc != SDE.st_type_user.se_success THEN
raise_application_error (SDE.st_type_util.st_no_srid,'SRID '||spref_r.srid||
' does not exist in ST_SPATIAL_REFERENCES table.');
End If;
shape.points := empty_blob();
shape.numpts := 0;
shape.entity := 0;
shape.minx := 0;
shape.miny := 0;
shape.maxx := 0;
shape.maxy := 0;
shape.area := 0;
shape.len := 0;
shape.minz := NULL;
shape.maxz := NULL;
shape.minm := NULL;
shape.maxm := NULL;
temp := lpad('a', 1, 'a');
tempraw := utl_raw.cast_to_raw (temp);
shape.points := tempraw;
If is_empty = False THEN
geom_type := SDE.st_geom_util.unspecified_type;
SDE.st_geometry_shapelib_pkg.geometryfromtext(buffer,spref_r.srid,spref_r.x_offset,spref_r.y_offset,spref_r.xyunits,
spref_r.z_offset,spref_r.z_scale,spref_r.m_offset,spref_r.m_scale,
spref_r.Definition,geom_type,shape.numpts,shape.entity,shape.minx,shape.miny,
shape.maxx,shape.maxy,shape.minz,shape.maxz,shape.minm,shape.maxm,
shape.area,shape.len,shape.points);
|