37 |
38 |
CityGML Objekte
39 |
44 |
48 |
49 |
50 |
Attribute
51 |
56 |
57 |
58 |
Attributwerte
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/geores_src/geores_parser/geores_featureparser/gres_cityfurniture_parser.rb:
--------------------------------------------------------------------------------
1 | # To change this template, choose Tools | Templates
2 | # and open the template in the editor.
3 | Sketchup::require 'geores_src/geores_parser/cityobjectparser.rb'
4 | Sketchup::require 'geores_src/geores_parser/geores_geo/grs_implicit_geometry_parser.rb'
5 | Sketchup::require 'geores_src/geores_debug/gres_cgmldebugger.rb'
6 |
7 | class GRES_CityFurnitureParser < CityObjectParser
8 | @currentImplicitParser = nil
9 | @isInImplicitGeometry = false
10 |
11 | def initialize(cityobject,factory)
12 | super(cityobject, factory)
13 | end
14 |
15 |
16 | def tag_start name, attrs
17 | GRES_CGMLDebugger.writedebugstring("GRES_CityFurnitureParser in tag_start mit " + name + "\n")
18 | if(@isInImplicitGeometry == true and @currentImplicitParser != nil)
19 | @currentImplicitParser.tag_start(name,attrs)
20 | return false
21 | end
22 | if(name.index("CityFurniture") != nil)
23 | id = getattrvalue("gml:id", attrs)
24 | if(id != "")
25 | @cityObject.setgmlid(id)
26 | end
27 | return false
28 | end
29 |
30 | if(super(name,attrs) == false)
31 | return false
32 | end
33 |
34 | if(name.index("class") != nil or name.index("function") != nil or name.index("usage") != nil)
35 | @currentSimpleAttribute = SimpleCityObjectAttribute.new(name, attrs)
36 | @isInSimpleAttribute = true
37 | return false
38 | end
39 | if(name.index("ImplicitRepresentation") != nil)
40 | @currentImplicitParser = GRS_ImplicitGeometryParser.new()
41 | @isInImplicitGeometry = true
42 | return false
43 | end
44 | return true
45 | end
46 |
47 | def text text
48 |
49 | if(@isInImplicitGeometry == true and @currentImplicitParser != nil)
50 | @currentImplicitParser.text(text)
51 | return false
52 | end
53 |
54 | if(super(text) == false)
55 | return false
56 | end
57 |
58 | if(@isInSimpleAttribute == true and @currentSimpleAttribute != nil)
59 | @currentSimpleAttribute.addValue(text)
60 | return false
61 | end
62 | return true
63 | end
64 |
65 | def tag_end name
66 |
67 | if(name.index("ImplicitRepresentation") != nil)
68 |
69 | implicitGeometry = @currentImplicitParser.geometry
70 | if(implicitGeometry.isreferenceobject == true)
71 | @cityObject.setisImplicitReferenceObject(true)
72 | else
73 | @cityObject.setisImplicitObject(true)
74 | end
75 | @cityObject.addImplicitGeometry(implicitGeometry, name)
76 | @isInImplicitGeometry = false
77 | @currentImplicitParser = nil
78 | return false
79 | end
80 | if(@isInImplicitGeometry == true and @currentImplicitParser != nil)
81 | @currentImplicitParser.tag_end(name)
82 | return false
83 | end
84 | if(super(name) == false)
85 | return false
86 | end
87 | if(name.index("class") != nil or name.index("function") != nil or name.index("usage") != nil)
88 | @cityObject.addSimpleAttribute(@currentSimpleAttribute)
89 | @isInSimpleAttribute = false
90 | @currentSimpleAttribute = nil
91 | return false
92 | end
93 | return true
94 | end
95 | end
96 |
--------------------------------------------------------------------------------
/geores_src/geores_parser/geores_featureparser/gres_generic_city_object_parser.rb:
--------------------------------------------------------------------------------
1 | # To change this template, choose Tools | Templates
2 | # and open the template in the editor.
3 | Sketchup::require 'geores_src/geores_parser/cityobjectparser.rb'
4 | Sketchup::require 'geores_src/geores_parser/geores_geo/grs_implicit_geometry_parser.rb'
5 | Sketchup::require 'geores_src/geores_debug/gres_cgmldebugger.rb'
6 |
7 | class GRES_GenericCityObjectParser < CityObjectParser
8 | @currentImplicitParser = nil
9 | @isInImplicitGeometry = false
10 |
11 | def initialize(cityobject,factory)
12 | super(cityobject, factory)
13 | end
14 |
15 |
16 | def tag_start name, attrs
17 | GRES_CGMLDebugger.writedebugstring("GRES_GenericCityObjectParser in tag_start mit " + name + "\n")
18 | if(@isInImplicitGeometry == true and @currentImplicitParser != nil)
19 | @currentImplicitParser.tag_start(name,attrs)
20 | return false
21 | end
22 | if(name.index("GenericCityObject") != nil)
23 | id = getattrvalue("gml:id", attrs)
24 | if(id != "")
25 | @cityObject.setgmlid(id)
26 | end
27 | return false
28 | end
29 |
30 | if(super(name,attrs) == false)
31 | return false
32 | end
33 |
34 | if(name.index("class") != nil or name.index("function") != nil or name.index("usage") != nil)
35 | @currentSimpleAttribute = SimpleCityObjectAttribute.new(name, attrs)
36 | @isInSimpleAttribute = true
37 | return false
38 | end
39 | if(name.index("ImplicitRepresentation") != nil)
40 | @currentImplicitParser = GRS_ImplicitGeometryParser.new()
41 | @isInImplicitGeometry = true
42 | return false
43 | end
44 | return true
45 | end
46 |
47 | def text text
48 |
49 | if(@isInImplicitGeometry == true and @currentImplicitParser != nil)
50 | @currentImplicitParser.text(text)
51 | return false
52 | end
53 |
54 | if(super(text) == false)
55 | return false
56 | end
57 |
58 | if(@isInSimpleAttribute == true and @currentSimpleAttribute != nil)
59 | @currentSimpleAttribute.addValue(text)
60 | return false
61 | end
62 | return true
63 | end
64 |
65 | def tag_end name
66 |
67 | if(name.index("ImplicitRepresentation") != nil)
68 |
69 | implicitGeometry = @currentImplicitParser.geometry
70 | if(implicitGeometry.isreferenceobject == true)
71 | @cityObject.setisImplicitReferenceObject(true)
72 | else
73 | @cityObject.setisImplicitObject(true)
74 | end
75 | @cityObject.addImplicitGeometry(implicitGeometry, name)
76 | @isInImplicitGeometry = false
77 | @currentImplicitParser = nil
78 | return false
79 | end
80 | if(@isInImplicitGeometry == true and @currentImplicitParser != nil)
81 | @currentImplicitParser.tag_end(name)
82 | return false
83 | end
84 | if(super(name) == false)
85 | return false
86 | end
87 | if(name.index("class") != nil or name.index("function") != nil or name.index("usage") != nil)
88 | @cityObject.addSimpleAttribute(@currentSimpleAttribute)
89 | @isInSimpleAttribute = false
90 | @currentSimpleAttribute = nil
91 | return false
92 | end
93 | return true
94 | end
95 | end
96 |
--------------------------------------------------------------------------------
/geores_src/geores_import/geores_rexml/geores_parsers/treeparser.rb:
--------------------------------------------------------------------------------
1 | Sketchup::require 'geores_src/geores_import/geores_rexml/geores_validation/validationexception.rb'
2 |
3 | module REXML
4 | module Parsers
5 | class TreeParser
6 | def initialize( source, build_context = Document.new )
7 | @build_context = build_context
8 | @parser = Parsers::BaseParser.new( source )
9 | end
10 |
11 | def add_listener( listener )
12 | @parser.add_listener( listener )
13 | end
14 |
15 | def parse
16 | tag_stack = []
17 | in_doctype = false
18 | entities = nil
19 | begin
20 | while true
21 | event = @parser.pull
22 | #STDERR.puts "TREEPARSER GOT #{event.inspect}"
23 | case event[0]
24 | when :end_document
25 | unless tag_stack.empty?
26 | #raise ParseException.new("No close tag for #{tag_stack.inspect}")
27 | raise ParseException.new("No close tag for #{@build_context.xpath}")
28 | end
29 | return
30 | when :start_element
31 | tag_stack.push(event[1])
32 | # find the observers for namespaces
33 | @build_context = @build_context.add_element( event[1], event[2] )
34 | when :end_element
35 | tag_stack.pop
36 | @build_context = @build_context.parent
37 | when :text
38 | if not in_doctype
39 | if @build_context[-1].instance_of? Text
40 | @build_context[-1] << event[1]
41 | else
42 | @build_context.add(
43 | Text.new(event[1], @build_context.whitespace, nil, true)
44 | ) unless (
45 | @build_context.ignore_whitespace_nodes and
46 | event[1].strip.size==0
47 | )
48 | end
49 | end
50 | when :comment
51 | c = Comment.new( event[1] )
52 | @build_context.add( c )
53 | when :cdata
54 | c = CData.new( event[1] )
55 | @build_context.add( c )
56 | when :processing_instruction
57 | @build_context.add( Instruction.new( event[1], event[2] ) )
58 | when :end_doctype
59 | in_doctype = false
60 | entities.each { |k,v| entities[k] = @build_context.entities[k].value }
61 | @build_context = @build_context.parent
62 | when :start_doctype
63 | doctype = DocType.new( event[1..-1], @build_context )
64 | @build_context = doctype
65 | entities = {}
66 | in_doctype = true
67 | when :attlistdecl
68 | n = AttlistDecl.new( event[1..-1] )
69 | @build_context.add( n )
70 | when :externalentity
71 | n = ExternalEntity.new( event[1] )
72 | @build_context.add( n )
73 | when :elementdecl
74 | n = ElementDecl.new( event[1] )
75 | @build_context.add(n)
76 | when :entitydecl
77 | entities[ event[1] ] = event[2] unless event[2] =~ /PUBLIC|SYSTEM/
78 | @build_context.add(Entity.new(event))
79 | when :notationdecl
80 | n = NotationDecl.new( *event[1..-1] )
81 | @build_context.add( n )
82 | when :xmldecl
83 | x = XMLDecl.new( event[1], event[2], event[3] )
84 | @build_context.add( x )
85 | end
86 | end
87 | rescue REXML::Validation::ValidationException
88 | raise
89 | rescue
90 | raise ParseException.new( $!.message, @parser.source, @parser, $! )
91 | end
92 | end
93 | end
94 | end
95 | end
96 |
--------------------------------------------------------------------------------
/geores_src/geores_schema/geores_feature/gres_water_boundary.rb:
--------------------------------------------------------------------------------
1 | # To change this template, choose Tools | Templates
2 | # and open the template in the editor.
3 | Sketchup::require 'geores_src/geores_schema/geores_feature/gres_cityobject.rb'
4 |
5 | class GRES_WaterBoundary < GRES_CityObject
6 |
7 |
8 | def initialize
9 | super()
10 | @type = ""
11 | end
12 |
13 | def setboundarytype t
14 | @type = t
15 | end
16 |
17 |
18 | attr_reader :type
19 |
20 | def buildToSKP(parent, entity, dictname, counter)
21 | puts "in buildToSKP Boundary"
22 | super(parent, entity, dictname, counter)
23 | dictionary = entity.attribute_dictionary(dictname, true)
24 | dictionary["type"] = @type
25 | dictionary["parent"] = parent
26 |
27 | end
28 |
29 | def buildFromSKP(entity, dictname)
30 |
31 | end
32 |
33 | def buildlod2multisurfacegeometry group, appearances, citygmlloader, parentnames, layer
34 | parents = Array.new()
35 | if(parentnames != nil)
36 | parents.concat(parentnames)
37 | end
38 | parents.push(@theinternalname)
39 | super(group, appearances, citygmlloader, parents, layer)
40 |
41 | end
42 |
43 |
44 |
45 | def buildlod3multisurfacegeometry group, appearances, citygmlloader, parentnames, layer
46 |
47 | parents = Array.new()
48 | if(parentnames != nil)
49 | parents.concat(parentnames)
50 | end
51 | parents.push(@theinternalname)
52 |
53 | super(group, appearances, citygmlloader, parents, layer)
54 |
55 | end
56 |
57 |
58 | def buildlod4multisurfacegeometry group, appearances, citygmlloader, parentnames, layer
59 | parents = Array.new()
60 | if(parentnames != nil)
61 | parents.concat(parentnames)
62 | end
63 | parents.push(@theinternalname)
64 |
65 |
66 | super(group, appearances, citygmlloader, parents, layer)
67 | end
68 |
69 | def writeToCityGML isWFST, namespace
70 | retstring = ""
71 | retstring << "<" + namespace + "boundedBy>\n"
72 | retstring << "<" + namespace + getBoundaryNameForInternalName() + " gml:id=\"" + @gmlid + "\">\n"
73 |
74 | @simpleCityObjectAttributes.each { |att|
75 |
76 | retstring << att.value
77 | }
78 |
79 | if(@lod2MultiSurface.length > 0)
80 | retstring << "<" + namespace + "lod2MultiSurface>\n"
81 | retstring << "