microstation 0.4.1 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +23 -23
  3. data/.rspec +2 -2
  4. data/Gemfile +28 -10
  5. data/History.txt +6 -6
  6. data/LICENSE.adoc +22 -0
  7. data/Manifest.txt +81 -60
  8. data/README.adoc +131 -0
  9. data/Rakefile +71 -30
  10. data/bin/dgn2pdf +36 -37
  11. data/bin/dgn_template +107 -0
  12. data/bin/microstation +231 -0
  13. data/bin/pw_print +35 -0
  14. data/cad_files/drawing_faatitle_in_non_default_model.dgn +0 -0
  15. data/cad_files/drawing_no_block.dgn +0 -0
  16. data/cad_files/drawing_with_3_block.dgn +0 -0
  17. data/cad_files/drawing_with_block.dgn +0 -0
  18. data/cad_files/seed2d.dgn +0 -0
  19. data/cad_files/test.dgn +0 -0
  20. data/lib/microstation.rb +252 -88
  21. data/lib/microstation/app.rb +781 -286
  22. data/lib/microstation/cad_input_queue.rb +100 -25
  23. data/lib/microstation/cell.rb +191 -0
  24. data/lib/microstation/changer.rb +70 -0
  25. data/lib/microstation/configuration.rb +193 -57
  26. data/lib/microstation/criteria_creation_t.rb +23 -0
  27. data/lib/microstation/dir.rb +252 -252
  28. data/lib/microstation/directory.rb +46 -0
  29. data/lib/microstation/drawing.rb +690 -189
  30. data/lib/microstation/element.rb +311 -0
  31. data/lib/microstation/enumerator.rb +32 -29
  32. data/lib/microstation/errors.rb +17 -0
  33. data/lib/microstation/event_handler.rb +28 -0
  34. data/lib/microstation/ext/pathname.rb +23 -25
  35. data/lib/microstation/ext/win32ole.rb +7 -0
  36. data/lib/microstation/extensions/faa.rb +124 -0
  37. data/lib/microstation/file_tests.rb +68 -0
  38. data/lib/microstation/functions.rb +60 -0
  39. data/lib/microstation/graphics.rb +35 -0
  40. data/lib/microstation/line.rb +19 -0
  41. data/lib/microstation/model.rb +45 -0
  42. data/lib/microstation/model_trait.rb +189 -0
  43. data/lib/microstation/ole_cad_input_message.rb +101 -0
  44. data/lib/microstation/ole_helper.rb +152 -0
  45. data/lib/microstation/pdf_support.rb +40 -40
  46. data/lib/microstation/point3d.rb +71 -0
  47. data/lib/microstation/primitive_command_interface.rb +66 -0
  48. data/lib/microstation/properties.rb +61 -57
  49. data/lib/microstation/property_handler.rb +48 -0
  50. data/lib/microstation/scan/color.rb +38 -38
  51. data/lib/microstation/scan/criteria.rb +89 -85
  52. data/lib/microstation/scan/klass.rb +43 -43
  53. data/lib/microstation/scan/level.rb +38 -38
  54. data/lib/microstation/scan/line_style.rb +45 -45
  55. data/lib/microstation/scan/line_weight.rb +33 -33
  56. data/lib/microstation/scan/range.rb +19 -0
  57. data/lib/microstation/scan/scan_trait.rb +51 -0
  58. data/lib/microstation/scan/subtype.rb +40 -40
  59. data/lib/microstation/scan/type.rb +134 -109
  60. data/lib/microstation/scan_trait.rb +62 -0
  61. data/lib/microstation/scanner.rb +24 -24
  62. data/lib/microstation/tag.rb +87 -58
  63. data/lib/microstation/tag_set.rb +385 -280
  64. data/lib/microstation/tag_set_trait.rb +51 -0
  65. data/lib/microstation/tagged_element.rb +105 -0
  66. data/lib/microstation/template.rb +90 -84
  67. data/lib/microstation/template_info.rb +172 -0
  68. data/lib/microstation/template_runner.rb +65 -0
  69. data/lib/microstation/text.rb +79 -54
  70. data/lib/microstation/text_node.rb +124 -74
  71. data/lib/microstation/ts/attribute.rb +140 -139
  72. data/lib/microstation/ts/instance.rb +146 -112
  73. data/lib/microstation/ts/tagset_trait.rb +49 -0
  74. data/lib/microstation/types.rb +91 -91
  75. data/lib/microstation/version.rb +5 -0
  76. data/lib/microstation/wrap.rb +28 -214
  77. data/plot/pdf-bw.plt +164 -164
  78. data/plot/pdf.plt +163 -163
  79. data/plot/png.plt +383 -383
  80. data/plot/tiff.plt +384 -384
  81. data/plot/wmbw.tbl +324 -66
  82. data/plot/wmcolor.tbl +62 -62
  83. metadata +301 -86
  84. data/.gemtest +0 -0
  85. data/README.txt +0 -75
  86. data/lib/microstation/attributes.rb +0 -35
  87. data/lib/microstation/extensions/hash.rb +0 -27
  88. data/spec/app_spec.rb +0 -267
  89. data/spec/configuration_spec.rb +0 -122
  90. data/spec/drawing_spec.rb +0 -247
  91. data/spec/drawings/new_drawing.dgn +0 -0
  92. data/spec/drawings/test.dgn +0 -0
  93. data/spec/drawings/test1.dgn +0 -0
  94. data/spec/drawings/testfile.pdf +0 -0
  95. data/spec/enumerator_spec.rb +0 -60
  96. data/spec/microstation_spec.rb +0 -36
  97. data/spec/scanner_spec.rb +0 -155
  98. data/spec/spec_app.rb +0 -11
  99. data/spec/spec_helper.rb +0 -31
  100. data/spec/tag_set_spec.rb +0 -123
  101. data/spec/text_node_spec.rb +0 -92
  102. data/spec/text_spec.rb +0 -62
data/spec/spec_app.rb DELETED
@@ -1,11 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
-
4
- describe Microstation::App do
5
-
6
- it "should allow you to " do
7
- app = Microstation::App.new
8
- app.ole_object.class.should == WIN32OLE
9
- end
10
-
11
- end
data/spec/spec_helper.rb DELETED
@@ -1,31 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
-
8
- if RUBY_VERSION =~ /1\.8/
9
- require 'rubygems'
10
- require 'require_relative'
11
- require 'ruby-debug'
12
- end
13
- require 'microstation'
14
- #
15
- DRAWING_DIR = File.join(File.dirname(__FILE__) , 'drawings')
16
- RSpec.configure do |config|
17
- config.treat_symbols_as_metadata_keys_with_true_values = true
18
- config.run_all_when_everything_filtered = true
19
- config.filter_run :focus
20
- end
21
-
22
- def drawing_path(file)
23
- drawing = File.join(DRAWING_DIR,file)
24
- File.expand_path(drawing)
25
- end
26
-
27
- def open_existing_drawing(app)
28
- app.open_drawing( drawing_path('test.dgn'))
29
- end
30
-
31
-
data/spec/tag_set_spec.rb DELETED
@@ -1,123 +0,0 @@
1
- require File.join(File.dirname(__FILE__) , 'spec_helper')
2
- require 'tempfile'
3
-
4
-
5
- module Helper
6
-
7
- def create_temp_drawing
8
- file = Tempfile.new('drawing.dgn')
9
- file.close
10
- @app.new_drawing(file.path)
11
- end
12
- end
13
-
14
-
15
-
16
- describe Microstation::TagSet do
17
-
18
- include Helper
19
-
20
- before(:all) do
21
- @app = Microstation::App.new
22
- end
23
-
24
- after(:all) do
25
- @app.close_active_drawing if @app
26
- @app.quit
27
- end
28
-
29
- describe 'a new drawing' do
30
- let(:new_drawing){ create_temp_drawing}
31
-
32
-
33
- context 'creating a new tag set' do
34
- let(:tagsets){ new_drawing.tagsets}
35
-
36
- it 'should have no initial tagsets' do
37
- tagsets['test'].should be_nil
38
- end
39
-
40
- it 'should return a tagset' do
41
- ts = tagsets.create('test')
42
- ts.should be_instance_of Microstation::TagSet
43
- end
44
-
45
- it 'should be the same as a found tagset' do
46
- ts = tagsets.create('test')
47
- tagsets['test'].should == ts
48
- end
49
-
50
- it 'should allow you to remove a tagset' do
51
- tagsets.create('test')
52
- tagsets.size.should == 1
53
- tagsets.remove('test')
54
- tagsets.should be_empty
55
- end
56
-
57
- end
58
- end
59
-
60
- describe 'A Tag Set' do
61
- let(:app) { @app}
62
- let(:new_drawing){ create_temp_drawing}
63
-
64
- describe "#create_tagset" do
65
-
66
- it 'should allow you to create' do
67
- ts = new_drawing.create_tagset('faatitle')
68
- ts.should be_instance_of Microstation::TagSet
69
- end
70
-
71
- it 'should yield to block if given a block' do
72
- new_drawing.create_tagset('faatitle') do |ts|
73
- ts.should be_an_instance_of Microstation::TagSet
74
- end
75
- end
76
-
77
- context 'given a new TagSet' do
78
- let(:tagset){ new_drawing.create_tagset('faatitle')}
79
-
80
- it 'should have no attributes' do
81
- tagset.attributes.should be_empty
82
- end
83
-
84
- it 'should allow you to add new definitions' do
85
- tagset.attributes.should be_empty
86
- td = tagset.add_attribute('title', String, :prompt => 'My title')
87
-
88
- td.prompt.should == 'My title'
89
- tagset.attributes.size.should == 1
90
- end
91
-
92
- end
93
-
94
-
95
- context 'given a tagset with tag definitions' do
96
- let(:tagset){ new_drawing.create_tagset('faatitle')}
97
- # let(:td1){ tagset.definition('title',String)}
98
- # let(:td2){ tagset.definition('city', String)}
99
-
100
- it 'should have correct size' do
101
- tagset.attributes.size.should == 0
102
- tagset.add_attribute('title', String)
103
- tagset.attributes.size.should == 1
104
- tagset.add_attribute('city',String)
105
- tagset.attributes.size.should == 2
106
- end
107
-
108
- it 'should allow you to retrieve a td' do
109
- td = tagset.add_attribute('title', String)
110
- tagset['title'].should == td
111
- end
112
- end
113
- end
114
-
115
- end
116
-
117
- end
118
-
119
-
120
-
121
-
122
-
123
-
@@ -1,92 +0,0 @@
1
- require File.join(File.dirname(__FILE__) , 'spec_helper')
2
-
3
- module NodeHelper
4
-
5
- def text_node_scanner(app)
6
- app.create_scanner do |scan|
7
- scan.include_text_nodes
8
- end
9
- end
10
- end
11
-
12
-
13
-
14
-
15
- describe "Microstation::TextNode" do
16
-
17
- include NodeHelper
18
-
19
- context "given a TextNode" do
20
-
21
- before(:all) do
22
- @app = Microstation::App.new
23
- @scanner = text_node_scanner(app)
24
- end
25
- after(:all) do
26
- @app.quit
27
- end
28
-
29
-
30
- let(:app){ @app }
31
- let(:drawing) { open_existing_drawing(app) }
32
- let(:text_node) { drawing.scan(@scanner).find{|t| !(t.empty?) }}
33
-
34
- it "should forward Capitalized methods to @ole_obj" do
35
- ole = double('ole')
36
- text_node.stub(:ole_obj).and_return(ole)
37
- ole.should_receive('Type').and_return
38
- text_node.Type
39
- end
40
-
41
- describe "ruby string methods" do
42
-
43
- context "calling with methods that don't change the string" do
44
-
45
- it "should not call the update method" do
46
- ole = double('ole')
47
- text_node.stub(:ole_obj).and_return(ole)
48
- text_node.should_not_receive('update_ole')
49
- ole.should_not_receive("Rewrite")
50
- text_node.reverse
51
- text_node.downcase
52
- end
53
-
54
- it "should give the correct value" do
55
- value = text_node.to_s
56
- text_node.reverse.to_s.should == value.reverse
57
- end
58
-
59
- it "should retain the same value" do
60
- value = text_node.to_s
61
- text_node.reverse
62
- text_node.to_s.should == value
63
- end
64
- end
65
-
66
- context "calling with methods that change the string" do
67
-
68
- it "should call the update method" do
69
- value = text_node.to_s
70
- reversed = value.reverse
71
- text_node.should_receive('update_ole').with(reversed)
72
- text_node.reverse!
73
- end
74
-
75
- it "should change to value" do
76
- value = text_node.to_s
77
- reversed = value.reverse
78
- text_node.reverse!
79
- text_node.to_s.should == reversed
80
- end
81
-
82
- end
83
-
84
- end
85
-
86
- end
87
- end
88
-
89
-
90
-
91
-
92
-
data/spec/text_spec.rb DELETED
@@ -1,62 +0,0 @@
1
- require File.join(File.dirname(__FILE__) , 'spec_helper')
2
-
3
- describe "Microstation:Text and Microstation::TextNode" do
4
-
5
-
6
- context "given a text node initialized by a scan" do
7
-
8
- before(:all) do
9
- @app = Microstation::App.new
10
- @drawing = open_existing_drawing(@app)
11
- @criteria = @app.create_scanner do |scan|
12
- scan.include_textual
13
- end
14
- @text_scan = @drawing.scan(@criteria)
15
- @text_enum = @text_scan.to_enum
16
- @text = @text_enum.find{|t| t.class == Microstation::Text}
17
- end
18
-
19
- after(:all) do
20
- @app.quit
21
- end
22
-
23
- let(:app) { @app}
24
- let(:drawing) {@drawing}
25
- let(:text) { @text}
26
-
27
- it "should be an instance of text" do
28
- text.should be_instance_of Microstation::Text
29
- end
30
-
31
- it "should forward all the methods to underlying text" do
32
- val = text.to_s
33
- text.reverse.should == val.reverse
34
- text.to_s.should == val
35
- puts "text: #{text}"
36
- end
37
-
38
- it "should forward all the Microstation commands to ole_obj" do
39
- pending
40
- text.IsTextElement.should be_true
41
- end
42
-
43
- it "should update the drawing if the text is changed" do
44
- pending
45
- id = text.microstation_id
46
- debugger
47
- puts "id: #{id}"
48
- puts "id class #{id.class}"
49
- val = text.to_s
50
- text.reverse!
51
- drawing_text = app.find_by_id(id)
52
- drawing_text.to_s.should == val.reverse
53
- end
54
-
55
-
56
-
57
-
58
- end
59
-
60
- end
61
-
62
-