新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论SVG, GML, X3D, VRML, VML, XAML, AVALON, Batik等基于XML的图形技术,以及有关GIS的应用。
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - 高级XML应用『 SVG/GML/VRML/X3D/XAML 』 → [转帖]Adobe SVG via COM/ActiveX - Part 1 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3102 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [转帖]Adobe SVG via COM/ActiveX - Part 1 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     SCYANGYU 帅哥哟,离线,有人找我吗?处女座1971-9-20
      
      
      威望:7
      等级:大四(每天看1小时莱昂氏)
      文章:217
      积分:1281
      门派:XML.ORG.CN
      注册:2005/2/17

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给SCYANGYU发送一个短消息 把SCYANGYU加入好友 查看SCYANGYU的个人资料 搜索SCYANGYU在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看SCYANGYU的博客楼主
    发贴心情 [转帖]Adobe SVG via COM/ActiveX - Part 1

    Trying to figure out how to use Adobe SVG via ActiveX/COM, instead of via HTML.

    In J++, you can get this to work by creating a form, adding an Adobe SVG ActiveX control, setting the SRC property to a valid SVG path, then calling for example:

    Object o = SVGCtl1.getSVGDocument();
    com.ms.com.CUnknown unknown = (com.ms.com.CUnknown) o;
    Object o2 = Dispatch.call(unknown, "getURL");
    MessageBox.show("" + o2.getClass().getName() + ": " + o2);


    I just tested using old J++ because it was easy. The real challenge was to do it using SWT/Java... here is an example of how to use the Adobe SVG ActiveX control in SWT. It shows how to call the getSVGDocument method the control and getURL method of the returned SVGDocument.

    You may ask why not use Batik if we are using Java, and the answer is the Adobe control is much faster. Nobody uses browsers written in Java for this reason...

    ActiveX Support in SWT provides good information, which I used to create this example.


    import java.io.*;

    import org.eclipse.swt.internal.ole.win32.*;
    import org.eclipse.swt.ole.win32.*;
    import org.eclipse.swt.widgets.*;
    import org.eclipse.swt.*;

    public class AxClientTest
    {
     public static void main(String[] args)
     {
      Display display = new Display();
      Shell shell = new Shell(display);
      OleFrame frame = new OleFrame(shell, SWT.NONE); 
      frame.setSize(400, 300);
      File file = new File("E:\\DevLibs\\batik-1.5\\samples\\3D.svg"); // path to your SVG here

      OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, file);

      clientSite.doVerb(OLE.OLEIVERB_SHOW);
      OleAutomation automation = new OleAutomation(clientSite);
      Variant v = automation.invoke(0x0000006b); // I looked this up in the ole/com type viewer - it is getSVGDocument

      OleAutomation a = v.getAutomation();
      int[] rgdispid = a.getIDsOfNames(new String[]{"getURL"}); // get the id for "getURL"

      // Note: you can get some of the basic properties here, but if you want to start accessing DOM elements,
      // you have to wait until the control has finished loading or initializing (not sure of the exact point at
      // which it starts working)
      Variant result = a.invoke(rgdispid[0]); // invoke getURL
      System.out.println(result.getString()); // print the URL


      shell.open ();
      while (!shell.isDisposed ()) {
       if (!shell.getDisplay().readAndDispatch ())
        shell.getDisplay().sleep ();
      }
     }
    }


    http://www.jroller.com/page/kenlars99/20040113


       收藏   分享  
    顶(0)
      




    ----------------------------------------------
    http://borland.mblogger.cn/scyangyu/

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/2/28 14:43:00
     
     GoogleAdSense处女座1971-9-20
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/7/27 19:11:10

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    46.875ms