/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/ArtToolInfo.cs
ViewVC logotype

Contents of /trunk/gr2lib/core/coretypes/implementation/ArtToolInfo.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (show annotations) (download)
Sat Jul 17 13:54:18 2010 UTC (9 years, 2 months ago) by william
File size: 4540 byte(s)
add compiler directive to write exceptions to console or not

1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using gr2lib.core.typedefs;
5 using gr2lib.core.helpers;
6 using Microsoft.Xna.Framework;
7 using gr2lib.core.interfaces;
8 using System.Diagnostics;
9 namespace gr2lib.core.coretypes.implementation
10 {
11
12
13 public class ArtToolInfo : IArtToolInfo
14 {
15 private FilePath _fromArtToolName;
16 private granny_int32 _artToolMajorRevision;
17 private granny_int32 _artToolMinorRevision;
18 private granny_real32 _unitsPerMeter;
19
20
21
22
23 private Vector3 _Origin;
24 private Vector3 _Right;
25 private Vector3 _Up;
26 private Vector3 _Back;
27
28 public ArtToolInfo()
29 {
30 this.FromArtToolName = "";
31 this.ArtToolMajorRevision = 0;
32 this.ArtToolMinorRevision = 0;
33 this.UnitsPerMeter = 1;
34 //this.ExtendedData = IntPtr.Zero;
35 //this.NativePointer = IntPtr.Zero;
36 this.Origin = new Vector3(0, 0, 0);
37 this.Right = new Vector3(0, 0, 0);
38 this.Up = new Vector3(0, 0, 0);
39 this.Back = new Vector3(0, 0, 0);
40
41
42 }
43 internal static ArtToolInfo ReadFromMemory(IntPtr pointer)
44 {
45 try
46 {
47
48 if (pointer == IntPtr.Zero) return null;
49 native.ArtToolInfo native = Helpers.ReadFromMemory<native.ArtToolInfo>(pointer);
50 ArtToolInfo managed = ReadFromNative(native);
51 managed.NativePointer = pointer;
52 return managed;
53 }
54 catch
55 {
56 StackTrace st = new StackTrace(true);
57 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
58 Console.WriteLine(st.ToString());
59 #endif
60 return default(ArtToolInfo);
61 }
62 }
63 internal static ArtToolInfo ReadFromNative(gr2lib.core.coretypes.native.ArtToolInfo native)
64 {
65 try
66 {
67 ArtToolInfo managed = new ArtToolInfo();
68 managed.FromArtToolName = string.IsNullOrEmpty(native.FromArtToolName) ? "{null}" : native.FromArtToolName;
69 managed.ArtToolMajorRevision = native.ArtToolMajorRevision;
70 managed.ArtToolMinorRevision = native.ArtToolMinorRevision;
71 //managed.ArtToolPointerSize = native.ArtToolPointerSize;
72 managed.UnitsPerMeter = native.UnitsPerMeter;
73 managed.Origin = new Vector3(native.Origin.X, native.Origin.Y, native.Origin.Z);
74 managed.Right = new Vector3(native.Right.X, native.Right.Y, native.Right.Z);
75 managed.Up = new Vector3(native.Up.X, native.Up.Y, native.Up.Z);
76 managed.Back = new Vector3(native.Back.X, native.Back.Y, native.Back.Z);
77 managed.ExtendedData = native.ExtendedData;
78 //managed.OnInvalidate();
79 return managed;
80 }
81 catch
82 {
83 StackTrace st = new StackTrace(true);
84 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
85 Console.WriteLine(st.ToString());
86 #endif
87 return default(ArtToolInfo);
88 }
89 }
90
91 #region IArtToolInfo Members
92 public FilePath FromArtToolName { get { return _fromArtToolName; } set { _fromArtToolName = value; } }
93 public granny_int32 ArtToolMajorRevision { get { return _artToolMajorRevision; } set { _artToolMajorRevision = value; } }
94 public granny_int32 ArtToolMinorRevision { get { return _artToolMinorRevision; } set { _artToolMinorRevision = value; } }
95 public granny_real32 UnitsPerMeter { get { return _unitsPerMeter; } set { _unitsPerMeter = value; } }
96 public Vector3 Origin { get { return _Origin; } set { _Origin = value; } }
97 public Vector3 Right { get { return _Right; } set { _Right = value; } }
98 public Vector3 Up { get { return _Up; } set { _Up = value; } }
99 public Vector3 Back { get { return _Back; } set { _Back = value; } }
100
101 #endregion
102
103 #region INativePointer Members
104 private IntPtr _NativePointer;
105 public IntPtr NativePointer { get { return _NativePointer; } set { _NativePointer = value; } }
106 #endregion
107
108 #region IExtendedData Members
109 private IntPtr _ExtendedData;
110 public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
111 #endregion
112
113 }
114 }
115

  ViewVC Help
Powered by ViewVC 1.1.22