GE Smallworld开发(003dxf文件导入导出问题)

本文介绍了GIS系统中DXF文件的导入与导出配置问题,包括如何避免激活DXF导入编辑器时出现错误,以及解决DXF导出时几何体部分超出选择区域导致的问题。此外还涉及了config.xml配置文件的正确设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

001、没有为DXF单独建立SOC的问题

1、用create_dxf_dataset()带默认参数,会为dxf数据建立独立的soc,:dxf_soc_def;
2、自己设定create_dxf_dataset()参数,可以在:gis soc下建立dxf数据集;

create_dxf_dataset({"D:\gis_refinery\ds\ds_admin"},"D:\gis_refinery\ds\ds_dxf","dxf.ds",:dxf,:gis)
$


问题来了:
1、如果是采用第一种方法,则在classic界面下,用
g.activate_dxf_import_editor()激活dxf文件导入编辑器时,会出错,提示没有dxf数据集。
原因是,g.activate_dxf_import_editor()找的是gis soc下面的dxf数据集,默认情况下
gis soc下是没有dxf数据集,要自己建立。可以用create_dxf_dataset()带参数建立。

2、如果用第二种方法建立,在Applications界面,选择"DXF Import & Export",会打不开界面。
原因是,config.xml文件中(在swaf_dxf_application模块下),属性"dxf_soc_def_name"的值,被设置为"dxf_soc_def"。而在这种
情况下,根本就没有"dxf_soc_def"的soc定义。

解决办法是,将属性"dxf_soc_def_name"的值,设置为"gis",
然后
将方法dxf_mapping_plugin.post_init_plugins()中的形如以下的内容
##a_database.add_transaction_group( a_soc )注释,重新加载该方法即可。

002、dxf_mapping_plugin.post_init_plugins方法修改

_method dxf_mapping_plugin.post_init_plugins()
 ##
 ## Do final initialisation of this plugin according to
 ## properties set from XML.
 ##
 ## Adds a new transaction group based on the dxf_soc_def_name
 ## property.
 ##
 ## Creates dependencies between _self, the DXF database view
 ## (.dxf_dsview), the user object dataset view .user_dsview
 ##

 a_database << _self.database
 
 _if (soc_name << _self.dxf_soc_def_name ) _isnt _unset
 _then
                a_soc << gis_program_manager.spatial_object_controller( soc_name )
                _if a_soc _is _unset _orif
                    a_soc.dataset_managers.empty?
                _then
                        a_soc << gis_program_manager.open_datasets( soc_name )
                _endif

  # by zhaoyong modify on 2009-09-03
  #注释以下语句
  #a_database.add_transaction_group( a_soc )
  #增加以下判断
  _if soc_name _isnt :gis
  _then
   a_database.add_transaction_group( a_soc )
  _endif
  #end   
 _endif

 .datasets_with_dxf  <<  _self.register_datasets( _true )
 .dxf_dsview         <<  _self.dxf_dataset_view

 _if .dxf_dsview _isnt _unset
 _then
  .dxf_dsview.add_dependent(_self)
 _endif
 
 _if a_database _isnt _unset
 _then
  a_database.add_dependent( _self, :mode, :view )
 _endif
 
 .user_dsview_list   << rope.new()

 # options for input transform
 .options << hash_table.new()
 
 # Create mapping application tables
 .translation_tables << hash_table.new()
 _if .dxf_dsview _isnt _unset
 _then
  # import mapping table
  .translation_tables[:dxf!application]                << .dxf_dsview.collections[:dxf!application]
  .translation_tables[:dxf!layers]                     << .dxf_dsview.collections[:dxf!layers]
  .translation_tables[:dxf!blocks]                     << .dxf_dsview.collections[:dxf!blocks]
  .translation_tables[:dxf!line_translations]          << .dxf_dsview.collections[:dxf!line_translations]
  .translation_tables[:dxf!point_translations]         << .dxf_dsview.collections[:dxf!point_translations]
  .translation_tables[:dxf!text_translations]          << .dxf_dsview.collections[:dxf!text_translations]
  .translation_tables[:dxf!insert_translations]        << .dxf_dsview.collections[:dxf!insert_translations]
  .translation_tables[:dxf!dimension_translations]     << .dxf_dsview.collections[:dxf!dimension_translations]
  .translation_tables[:dxf!block_attr_translations]    << .dxf_dsview.collections[:dxf!block_attr_translations]

  # Export mapping table
  .translation_tables[:dxf!output_application]         <<  .dxf_dsview.collections[:dxf!output_application]
  .translation_tables[:dxf!chain_out_translations]     << .dxf_dsview.collections[:dxf!chain_out_translations]
  .translation_tables[:dxf!area_out_translations]      << .dxf_dsview.collections[:dxf!area_out_translations]
  .translation_tables[:dxf!text_out_translations]      << .dxf_dsview.collections[:dxf!text_out_translations]
  .translation_tables[:dxf!point_out_translations]     << .dxf_dsview.collections[:dxf!point_out_translations]
  .translation_tables[:dxf!dimension_out_translations] << .dxf_dsview.collections[:dxf!dimension_out_translations]
  .translation_applications << _self.input_app_list()
  .output_translation_applications << _self.output_app_list()
 _endif
 
 # set app_id with Default input translation application.
 _self.set_app_value(0)

 # set app_id with Default output translation application.
 _self.set_output_app_value(0)
 
 # set the default dxf_file_id.
 _self.set_dxf_file_id(0)
 
_endmethod
$

003、dxf导出问题

DXF文件导出问题

选择DXF文件导出时,当选择好导出区域后,对该区域内的Geometry的处理有三个选项
Clipped   Overlapping   Inside
默认为Inside,如果Geometry比较大,没有完全包含在选择区域内是,导出会终止。这时
可以选择Clipped选项。

004、config.xml配置文件

<!-- config.xml for the SWAF DXF Application -->
<config base="swaf_professional_application.config">

    <plugins>

 <plugin name="editor_manager" class_name="editor_manager" >
     <properties>
         <property name="configuration_file_name"           value="swaf_dxf_application.collection_config" />
         <property name="editor_gui_definition_module_name" value="swaf_professional_application"/>
         <property name="editor_gui_definition_file_name"   value="editor_gui.xml"/>
     </properties>
 </plugin>

 <plugin name="dxf" class_name="dxf_mapping_plugin">
     <properties> 
  <!--
         <property name="dxf_soc_def_name"    value="dxf_soc_def" /> 
  -->
  <property name="dxf_soc_def_name"    value="gis" />  
     </properties>
 </plugin>

    </plugins>
</config>

 

内容概要:本文档主要展示了C语言中关于字符串处理、指针操作以及动态内存分配的相关代码示例。首先介绍了如何实现键值对(“key=value”)字符串的解析,包括去除多余空格和根据键获取对应值的功能,并提供了相应的测试用例。接着演示了从给定字符串中分离出奇偶位置字符的方法,并将结果分别存储到两个不同的缓冲区中。此外,还探讨了常量(const)修饰符在变量和指针中的应用规则,解释了不同类型指针的区别及其使用场景。最后,详细讲解了如何动态分配二维字符数组,并实现了对这类数组的排序与释放操作。 适合人群:具有C语言基础的程序员或计算机科学相关专业的学生,尤其是那些希望深入理解字符串处理、指针操作以及动态内存管理机制的学习者。 使用场景及目标:①掌握如何高效地解析键值对字符串并去除其中的空白字符;②学会编写能够正确处理奇偶索引字符的函数;③理解const修饰符的作用范围及其对程序逻辑的影响;④熟悉动态分配二维字符数组的技术,并能对其进行有效的排序和清理。 阅读建议:由于本资源涉及较多底层概念和技术细节,建议读者先复习C语言基础知识,特别是指针和内存管理部分。在学习过程中,可以尝试动手编写类似的代码片段,以便更好地理解和掌握文中所介绍的各种技巧。同时,注意观察代码注释,它们对于理解复杂逻辑非常有帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值