以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 SVG/GML/VRML/X3D/XAML 』 (http://bbs.xml.org.cn/list.asp?boardid=21) ---- 基于SVG+XMLHTTP+ORACLE SPATIAL的WEBGIS基础平台实例新址[分享] (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=42793) |
-- 作者:zhou_gong -- 发布时间:1/26/2007 6:31:00 AM -- 基于SVG+XMLHTTP+ORACLE SPATIAL的WEBGIS基础平台实例新址[分享] 大家好,网站终于重新开通了:HTTP://222.216.109.154:7799/ 欢迎大家与大家交流,QQ:185006613,zhou_gong_nn@163.com 注:使用前必须安装SVG插件(ADOBE公司的) 此主题相关图片如下: |
-- 作者:zhou_gong -- 发布时间:2/22/2007 10:19:00 AM -- 难道没有人对此技术的实现感兴趣吗? |
-- 作者:hiker365 -- 发布时间:3/14/2007 11:48:00 PM -- 做的不错,我的毕业设计也做这个,能说说你是怎么做的吗? 用了那些技术,看那些资料呢? 能把一些相关的资料贴出来吗? 或发给我一份:hiker365@163.com 非常感谢了!有时间可以交流一下 ----------------- 学了一段时间的orcale SPATIAL 感觉这个很难呀! |
-- 作者:zhou_gong -- 发布时间:3/15/2007 8:11:00 AM -- http://222.216.109.154:7799/ 摘要 功能: |
-- 作者:hiker365 -- 发布时间:3/15/2007 12:40:00 PM -- 我的毕业设计和这个相比要简单多了,只要把orcale spatial中的图形用svg显示出来就行了。orcale spatial建表存图形我会了但是如何生成svg不知到怎么办,还没有思路,你能给我一些指点吗?我该看那些方面的资料呢? 谢谢!
|
-- 作者:zhou_gong -- 发布时间:3/28/2007 8:17:00 AM -- 下面是GEOM转换到SVG格式的PL/SQL代码: FUNCTION geom_to_svgpath(v_geom SDO_GEOMETRY) RETURN CLOB as --v_path VARCHAR2(32767) := ''; v_path clob := ''; i binary_integer; j binary_integer; k binary_integer; m binary_integer := precision; v_offend binary_integer; v_count binary_integer; v_subelem binary_integer; v_elem_info SDO_ELEM_INFO_ARRAY; v_ordinates SDO_ORDINATE_ARRAY; v_offset binary_integer; v_etype binary_integer; v_interpret binary_integer; begin --本函数转换线、面状类型空间数据到SVG; IF NOT ( v_geom.SDO_GTYPE = 2002 -- 线 OR v_geom.SDO_GTYPE = 2003 -- 面 OR v_geom.SDO_GTYPE = 2004 -- 混集合 OR v_geom.SDO_GTYPE = 2006 -- 线集合 OR v_geom.SDO_GTYPE = 2007) -- 面集合 THEN RETURN NULL; END IF; v_elem_info := v_geom.sdo_elem_info; v_ordinates := v_geom.sdo_ordinates; v_count := v_elem_info.count(); v_subelem := 0; i := 0; WHILE i< v_count LOOP i := i + 1; v_offset := v_elem_info(i); i := i + 1; v_etype := MOD(v_elem_info(i),1000); i := i + 1; v_interpret:= v_elem_info(i); --处理空间对象中的一条线或一个面的开始 IF v_path = '' OR v_path IS NULL THEN v_path := 'M'; ELSE DBMS_LOB.APPEND(v_path, ' M'); END IF; CASE v_etype --处理简单线 WHEN 2 THEN CASE v_interpret --处理由纯折线构成的简单线; WHEN 1 THEN IF i = v_count THEN v_offend := v_ordinates.count(); ELSE v_offend := v_elem_info(i+1) - 1; END IF; FOR j IN v_offset..v_offend LOOP DBMS_LOB.APPEND(v_path , (' ' || TO_CHAR(v_ordinates(j)))) ; END LOOP; --处理由纯圆弧构成的简单线; WHEN 2 THEN IF i = v_count THEN v_offend := v_ordinates.count()- 5; ELSE v_offend := v_elem_info(i+1) - 6; END IF; j := v_offset; DBMS_LOB.APPEND(v_path,( ' ' || TO_CHAR(v_ordinates(j)) || ' ' || TO_CHAR(v_ordinates(j+1)))) ; WHILE j<= v_offend LOOP DBMS_LOB.APPEND(v_path, (arc_to_svgpath(v_ordinates(j) ,v_ordinates(j+1), v_ordinates(j+2),v_ordinates(j+3), v_ordinates(j+4),v_ordinates(j+5), 1))); j := j + 4; END LOOP; END CASE; --处理面数据; WHEN 3 THEN CASE v_interpret --处理由纯折线构成的面; WHEN 1 THEN IF i = v_count THEN v_offend := v_ordinates.count()- 2; ELSE v_offend := v_elem_info(i+1) - 3; END IF; FOR j IN v_offset..v_offend LOOP DBMS_LOB.APPEND(v_path,( ' ' || TO_CHAR(v_ordinates(j)))) ; END LOOP; v_path := v_path || ' Z'; --处理由纯圆弧构成的面; WHEN 2 THEN IF i = v_count THEN v_offend := v_ordinates.count()- 5; ELSE v_offend := v_elem_info(i+1) - 6; END IF; j := v_offset; DBMS_LOB.APPEND(v_path,( ' ' || to_char(v_ordinates(j)) || ' ' || to_char(v_ordinates(j+1)))); WHILE j<= v_offend LOOP DBMS_LOB.APPEND(v_path,( arc_to_svgpath(v_ordinates(j) ,v_ordinates(j+1), v_ordinates(j+2),v_ordinates(j+3), v_ordinates(j+4),v_ordinates(j+5), 1))); j := j + 4; END LOOP; --处理矩形; WHEN 3 THEN j := v_offset; DBMS_LOB.APPEND(v_path,(' '|| TO_CHAR(v_ordinates(j)) || ' ' || TO_CHAR(v_ordinates(j+1)))); DBMS_LOB.APPEND(v_path,(' '|| TO_CHAR(v_ordinates(j+2)) || ' ' || TO_CHAR(v_ordinates(j+1)))); DBMS_LOB.APPEND(v_path,(' '|| TO_CHAR(v_ordinates(j+2)) || ' ' || TO_CHAR(v_ordinates(j+3)))); DBMS_LOB.APPEND(v_path,(' '|| TO_CHAR(v_ordinates(j)) || ' ' || TO_CHAR(v_ordinates(j+3) || ' Z'))); --处理园; WHEN 4 THEN j := v_offset; DBMS_LOB.APPEND(v_path,(arc_to_svgpath(v_ordinates(j) ,v_ordinates(j+1), v_ordinates(j+2),v_ordinates(j+3), v_ordinates(j+4),v_ordinates(j+5), 0))); END CASE; --处理复合线; WHEN 4 THEN DBMS_LOB.APPEND(v_path,( ' ' || TO_CHAR(v_ordinates(v_offset)) || ' ' || TO_CHAR(v_ordinates(v_offset + 1)))); --复合线中连续折线和连续园弧个数; v_subelem := v_interpret; --处理每一连续折线或连续园弧; FOR k IN 1..v_subelem LOOP i := i + 1; v_offset := v_elem_info(i) ; i := i + 1; v_etype := MOD(v_elem_info(i),1000); i := i + 1; v_interpret:= v_elem_info(i); CASE v_interpret --处理连续折线; WHEN 1 THEN IF i = v_count THEN v_offend := v_ordinates.count(); ELSE IF k = v_subelem THEN v_offend := v_elem_info(i+1) - 1; ELSE v_offend := v_elem_info(i+1) + 1; END IF; END IF; IF k>1 THEN v_path := v_path || ' L'; END IF; FOR j IN (v_offset + 2)..v_offend LOOP DBMS_LOB.APPEND(v_path,( ' ' || TO_CHAR(v_ordinates(j)))) ; END LOOP; --处理连续圆弧;; WHEN 2 THEN IF i = v_count THEN v_offend := v_ordinates.count()- 5; ELSE IF k = v_subelem THEN v_offend := v_elem_info(i+1) - 6; ELSE v_offend := v_elem_info(i+1) - 4; END IF; END IF; j := v_offset; --v_path := v_path || ' A'; WHILE j<= v_offend LOOP DBMS_LOB.APPEND(v_path,(arc_to_svgpath(v_ordinates(j) ,v_ordinates(j+1), v_ordinates(j+2),v_ordinates(j+3), v_ordinates(j+4),v_ordinates(j+5), 1))); j := j + 4; END LOOP; END CASE; END LOOP; --处理复合线构成的面; WHEN 5 THEN DBMS_LOB.APPEND(v_path,(' ' || TO_CHAR(v_ordinates(v_offset)) || ' ' || TO_CHAR(v_ordinates(v_offset + 1)))); v_subelem := v_interpret; FOR k IN 1..v_subelem LOOP i := i + 1; v_offset := v_elem_info(i) ; i := i + 1; v_etype := MOD(v_elem_info(i),1000); i := i + 1; v_interpret:= v_elem_info(i); CASE v_interpret --处理复合面中的折线; WHEN 1 THEN IF i = v_count THEN v_offend := v_ordinates.count(); ELSE IF k = v_subelem THEN v_offend := v_elem_info(i+1) - 1; ELSE v_offend := v_elem_info(i+1) + 1; END IF; END IF; IF k>1 THEN DBMS_LOB.APPEND(v_path, ' L'); END IF; FOR j IN (v_offset + 2)..v_offend LOOP DBMS_LOB.APPEND(v_path,( ' ' || TO_CHAR(v_ordinates(j)))); END LOOP; --处理复合面中的弧线;; WHEN 2 THEN IF i = v_count THEN v_offend := v_ordinates.count()- 5; ELSE IF k = v_subelem THEN v_offend := v_elem_info(i+1) - 6; ELSE v_offend := v_elem_info(i+1) - 4; END IF; END IF; j := v_offset; --v_path := v_path || ' A'; WHILE j<= v_offend LOOP DBMS_LOB.APPEND(v_path, arc_to_svgpath(v_ordinates(j) ,v_ordinates(j+1), v_ordinates(j+2),v_ordinates(j+3), v_ordinates(j+4),v_ordinates(j+5), 1)); j := j + 4; END LOOP; END CASE; END LOOP; END CASE; END LOOP; RETURN v_path; /* EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE( i || ',' || j || ',' || v_ordinates.COUNT() || ',' || v_elem_info.COUNT()); DBMS_OUTPUT.PUT_LINE( v_ordinates(j) || ',' || v_ordinates(j+1)); DBMS_OUTPUT.PUT_LINE (v_path); RETURN NULL; */ end; FUNCTION arc_to_svgpath(x1 NUMBER,y1 NUMBER, x2 NUMBER,y2 NUMBER, x3 NUMBER,y3 NUMBER, is_arc NUMBER ) return CLOB AS v_path CLOB:=''; cx NUMBER; --弧中心点坐标; cy NUMBER; r NUMBER; --弧半径; s NUMBER; s12 NUMBER; s13 NUMBER; m NUMBER :=precision; begin s := 2 * ((x3 - x1)*(y2 - y1) -(x2 - x1)*(y3 - y1)); --DBMS_OUTPUT.PUT_LINE('S:' || S); IF s> -1e-10 AND s<1e-10 THEN IF is_arc = 1 THEN v_path := ' L ' || x1 || ' ' || y1 ||' ' ||x3 || ' ' || y3; END IF; RETURN v_path; END IF; s12 := x1*x1 + y1*y1; s13 := x3*x3 + y3*y3 - s12; s12 := x2*x2 + y2*y2 - s12; cx := (s13*(y2 - y1) - s12*(y3 - y1))/s; cy := -(s13*(x2 - x1) - s12*(x3 - x1))/s; r := sqrt((x1 - cx)*(x1 - cx) + (y1 - cy)*(y1 - cy)); r := round(r,4); IF is_arc=1 THEN S12 := (x3 - x1)*(cy - y1) - (cx - x1)*(y3 - y1); v_path := ' A ' || r || ' ' || r || ' 0'; IF (s * s12) < 0 THEN v_path := v_path || ' 0'; ELSE v_path := v_path || ' 1'; END IF; IF s>0 THEN v_path := v_path || ' 0'; ELSE v_path := v_path || ' 1'; END IF; v_path := v_path || ' ' || x3 || ' ' || y3; ELSE v_path := ' ' || (cx - r) || ' ' || cy || ' A ' || r || ' ' || r || ' 0 0 1 ' || (cx + r) || ' ' || cy || ' A ' || r || ' ' || r || ' 0 0 1 ' || (cx - r) || ' ' || cy; END IF; RETURN v_path; end; |
-- 作者:nika -- 发布时间:4/6/2007 3:41:00 PM -- 你给的网站一直上不去啊,我对Oracle Spatial应用方面也很感兴趣,能不能给我份程序参考一下,我的邮箱:zhy241@sina.com.cn |
-- 作者:zhou_gong -- 发布时间:8/14/2007 8:28:00 PM -- 大家好,好久没有上网了,如谁需要原代码,与我联系,自我介绍我可以贡献出来.QQ185006613,zhou_gong_nn@163.com |
-- 作者:zhou_gong -- 发布时间:8/14/2007 8:37:00 PM -- 下面是svg转换到GEOM格式的PL/SQL代码: FUNCTION svgpath_to_geom(v_path CLOB) RETURN SDO_GEOMETRY AS v_geom SDO_GEOMETRY; v_geom1 SDO_GEOMETRY; v_geom2 SDO_GEOMETRY; v_elem_info SDO_ELEM_INFO_ARRAY; v_ordinates SDO_ORDINATE_ARRAY; v_xy_count binary_integer; v_path_len binary_integer; i binary_integer; j binary_integer; v_count1 binary_integer := 0; v_count2 binary_integer := 0; v_str VARCHAR2(100); v_command char(1); v_data_count binary_integer; x1 NUMBER; --弧的起点; y1 NUMBER; x2 NUMBER; --弧上点; y2 NUMBER; x3 NUMBER; --弧的终点; y3 NUMBER; s NUMBER; --弧弦长度; h NUMBER; --弧高度; r NUMBER; --弧半径; large_arc NUMBER; --大弧标志=1; sweep_flag NUMBER; --顺时针方向=1; m binary_integer := precision; BEGIN IF v_path IS NULL THEN RETURN NULL; END IF; v_path_len := LENGTH(v_path); IF v_path_len < 10 THEN RETURN NULL; END IF; i := 1; IF get_svgdata(v_path,i) <> 'M' THEN RETURN NULL; END IF; i := 1; LOOP v_str := get_svgdata(v_path,i); EXIT WHEN v_str IS NULL; IF v_str ='M' THEN v_command := 'M'; IF v_elem_info IS NOT NULL THEN v_geom := SDO_GEOM.SDO_XOR(v_geom,reform_geom(v_elem_info,v_ordinates),tolerance); END IF; v_elem_info := SDO_ELEM_INFO_ARRAY(1,0,1,1,2,1); v_ordinates := SDO_ORDINATE_ARRAY(); v_xy_count := 0; ELSIF v_str = 'A' THEN IF v_xy_count = 2 THEN v_elem_info(v_elem_info(3)*3 + 3) := 2; ELSIF v_xy_count <2 THEN RETURN NULL; ELSE IF v_elem_info(v_elem_info(3)*3 + 3) = 1 THEN v_elem_info(3) := v_elem_info(3) + 1; v_elem_info.EXTEND(3); v_elem_info(v_elem_info(3)*3 + 1) := v_xy_count - 1; v_elem_info(v_elem_info(3)*3 + 2) := 2; v_elem_info(v_elem_info(3)*3 + 3) := 2; END IF; END IF; v_command := 'A'; ELSIF v_str = 'L' THEN IF v_xy_count <2 THEN RETURN NULL; ELSE IF v_elem_info(v_elem_info(3)*3 + 3) = 2 THEN v_elem_info(3) := v_elem_info(3) + 1; v_elem_info.EXTEND(3); v_elem_info(v_elem_info(3)*3 + 1) := v_xy_count - 1; v_elem_info(v_elem_info(3)*3 + 2) := 2; v_elem_info(v_elem_info(3)*3 + 3) := 1; END IF; END IF; v_command := 'L'; ELSIF v_str = 'Z' THEN IF v_xy_count <2 THEN RETURN NULL; END IF; IF v_ordinates(1) <> v_ordinates(v_xy_count - 1) OR v_ordinates(2) <> v_ordinates(v_xy_count ) THEN IF v_elem_info(v_elem_info(3)*3 + 3) = 2 THEN v_elem_info(3) := v_elem_info(3) + 1; v_elem_info.EXTEND(3); v_elem_info(v_elem_info(3)*3 + 1) := v_xy_count - 1; v_elem_info(v_elem_info(3)*3 + 2) := 2; v_elem_info(v_elem_info(3)*3 + 3) := 1; END IF; v_ordinates.EXTEND(2); v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := v_ordinates(1); v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := v_ordinates(2); END IF; v_command := 'Z'; ELSE IF v_command = 'M' OR v_command ='L' THEN v_ordinates.EXTEND(2); v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := TO_NUMBER(v_str); v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := TO_NUMBER(get_svgdata(v_path,i)); -- DBMS_OUTPUT.PUT_LINE('M:' || x || ',' || y || 'len:' || v_ordinates.COUNT); ELSIF v_command = 'A' THEN x1 := v_ordinates(v_xy_count - 1); y1 := v_ordinates(v_xy_count ); r := TO_NUMBER(v_str); v_str := get_svgdata(v_path,i); v_str := get_svgdata(v_path,i); large_arc := TO_NUMBER(get_svgdata(v_path,i)); sweep_flag := TO_NUMBER(get_svgdata(v_path,i)); x3 := TO_NUMBER(get_svgdata(v_path,i)); y3 := TO_NUMBER(get_svgdata(v_path,i)); s := SQRT((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1)); IF s > r*2 THEN r := s/2; h := r; ELSE h := r - SQRT(r*r - s*s/4); IF large_arc = 1 THEN h := 2*r - h; END IF; END IF; IF sweep_flag = 1 THEN x2 := (x1 + X3)/2 + h*(y3 - y1)/s; y2 := (y1 + Y3)/2 - h*(x3 - x1)/s; ELSE x2 := (x1 + X3)/2 - h*(y3 - y1)/s; y2 := (y1 + Y3)/2 + h*(x3 - x1)/s; END IF; v_ordinates.EXTEND(4); v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := x2; v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := y2; v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := x3; v_xy_count := v_xy_count + 1; v_ordinates(v_xy_count) := y3; -- DBMS_OUTPUT.PUT_LINE('A:' || r || ','|| x || ',' || y); ELSE RETURN NULL; END IF; END IF; END LOOP; --DBMS_OUTPUT.PUT_LINE(v_ordinates.COUNT); v_geom := SDO_GEOM.SDO_XOR(v_geom,reform_geom(v_elem_info,v_ordinates),tolerance); RETURN v_geom; END; FUNCTION reform_geom(v_elem_info IN OUT NOCOPY SDO_ELEM_INFO_ARRAY,v_ordinates IN OUT NOCOPY SDO_ORDINATE_ARRAY) RETURN SDO_GEOMETRY AS v_geom SDO_GEOMETRY; v_xy_count binary_integer; BEGIN IF (v_elem_info IS NULL) OR (v_ordinates IS NULL) THEN RETURN NULL; ELSE v_geom := SDO_GEOMETRY(NULL,NULL,NULL,NULL,v_ordinates); v_xy_count := v_ordinates.COUNT; IF v_ordinates(1) = v_ordinates(v_xy_count - 1) AND v_ordinates(2) = v_ordinates(v_xy_count ) THEN v_geom.SDO_GTYPE := 2003; ELSE v_geom.SDO_GTYPE := 2002; END IF; IF v_elem_info(3)>1 THEN IF v_geom.SDO_GTYPE = 2002 THEN v_elem_info(2) := 4; ELSE v_elem_info(2) := 1005; END IF; ELSE IF v_geom.SDO_GTYPE = 2002 THEN v_elem_info(2) := 2; v_elem_info(3) := v_elem_info(6); ELSE v_elem_info(2) := 1003; v_elem_info(3) := v_elem_info(6); END IF; v_elem_info.TRIM(3); END IF; v_geom.SDO_ELEM_INFO := v_elem_info; v_geom := SDO_GEOM.SDO_INTERSECTION(v_geom,max_shape,tolerance); RETURN v_geom; END IF; END ; FUNCTION get_svgdata(v_path CLOB,pos IN OUT binary_integer) RETURN VARCHAR2 AS v_data VARCHAR2(100); j binary_integer; BEGIN LOOP j := INSTR(v_path, ' ',pos,1); IF j = pos THEN pos := pos + 1; ELSE EXIT; END IF; END LOOP; IF j = 0 THEN j :=LENGTH(v_path) + 1; END IF; v_data := SUBSTR(v_path,pos,(j - pos)); pos := j + 1; RETURN v_data; END; |
-- 作者:frogbag -- 发布时间:10/17/2007 10:18:00 AM -- 给我一份,frogbag@163.com,谢谢 给我一份,frogbag@163.com,谢谢 |
-- 作者:Tsinghua_shi -- 发布时间:10/23/2007 11:39:00 AM -- 同等 |
-- 作者:followicey1982 -- 发布时间:10/23/2007 2:56:00 PM -- 做的不错,能发一份给我吗?我也想研究一下,辛苦楼主 icey1982@163.com |
-- 作者:wjcumt001 -- 发布时间:11/15/2007 9:20:00 AM -- 网站一直上不去啊 |
-- 作者:wjcumt001 -- 发布时间:11/15/2007 9:23:00 AM -- 关注 |
-- 作者:hzrong123 -- 发布时间:12/6/2007 2:52:00 PM -- 请给我一份,hzrong123@163.com,不胜感激! |
-- 作者:ojahe -- 发布时间:8/10/2008 8:30:00 PM -- 你好。能给我一份吗?谢谢!egreen88@sohu.com |
-- 作者:zpjdgp888 -- 发布时间:8/12/2008 8:38:00 AM -- 这贴子快2年了,被你挖出来这么回一句,我晕 |
-- 作者:byterman -- 发布时间:9/2/2008 3:38:00 PM -- 请给我一份,bytesman@163.com,不胜感激! |
-- 作者:mutian12345 -- 发布时间:11/28/2008 12:04:00 AM -- mafengmei.fm@126.com 等待 |
-- 作者:ccgk831 -- 发布时间:7/4/2009 9:35:00 AM -- ccgk831@hostmail.com来一份 |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
328.125ms |