diff options
Diffstat (limited to 'OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs')
-rw-r--r-- | OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs | 284 |
1 files changed, 142 insertions, 142 deletions
diff --git a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs index 8026373..ab0115e 100644 --- a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs +++ b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs | |||
@@ -1,143 +1,143 @@ | |||
1 | using System; | 1 | using System; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using TribalMedia.Framework.Data; | 3 | using TribalMedia.Framework.Data; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Framework.Data | 6 | namespace OpenSim.Framework.Data |
7 | { | 7 | { |
8 | public class PrimitiveBaseShapeRowMapper : RowMapper<PrimitiveBaseShape> | 8 | public class PrimitiveBaseShapeRowMapper : RowMapper<PrimitiveBaseShape> |
9 | { | 9 | { |
10 | public Guid SceneObjectPartId; | 10 | public Guid SceneObjectPartId; |
11 | 11 | ||
12 | public PrimitiveBaseShapeRowMapper(Schema schema, PrimitiveBaseShape obj) : base(schema, obj) | 12 | public PrimitiveBaseShapeRowMapper(Schema schema, PrimitiveBaseShape obj) : base(schema, obj) |
13 | { | 13 | { |
14 | } | 14 | } |
15 | } | 15 | } |
16 | 16 | ||
17 | public class PrimitiveBaseShapeTableMapper : ObjectTableMapper<PrimitiveBaseShapeRowMapper, Guid> | 17 | public class PrimitiveBaseShapeTableMapper : ObjectTableMapper<PrimitiveBaseShapeRowMapper, Guid> |
18 | { | 18 | { |
19 | public PrimitiveBaseShapeTableMapper(DatabaseMapper connection, string tableName) | 19 | public PrimitiveBaseShapeTableMapper(DatabaseMapper connection, string tableName) |
20 | : base(connection, tableName) | 20 | : base(connection, tableName) |
21 | { | 21 | { |
22 | RowMapperSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new RowMapperSchema<PrimitiveBaseShapeRowMapper>(this); | 22 | RowMapperSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new RowMapperSchema<PrimitiveBaseShapeRowMapper>(this); |
23 | m_schema = rowMapperSchema; | 23 | m_schema = rowMapperSchema; |
24 | 24 | ||
25 | m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId", | 25 | m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId", |
26 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; }, | 26 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; }, |
27 | delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; }); | 27 | delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; }); |
28 | 28 | ||
29 | rowMapperSchema.AddMapping<byte>("PCode", | 29 | rowMapperSchema.AddMapping<byte>("PCode", |
30 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; }, | 30 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; }, |
31 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; }); | 31 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; }); |
32 | 32 | ||
33 | rowMapperSchema.AddMapping<ushort>("PathBegin", | 33 | rowMapperSchema.AddMapping<ushort>("PathBegin", |
34 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; }, | 34 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; }, |
35 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; }); | 35 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; }); |
36 | 36 | ||
37 | rowMapperSchema.AddMapping<ushort>("PathEnd", | 37 | rowMapperSchema.AddMapping<ushort>("PathEnd", |
38 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; }, | 38 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; }, |
39 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; }); | 39 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; }); |
40 | 40 | ||
41 | rowMapperSchema.AddMapping<byte>("PathScaleX", | 41 | rowMapperSchema.AddMapping<byte>("PathScaleX", |
42 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; }, | 42 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; }, |
43 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; }); | 43 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; }); |
44 | 44 | ||
45 | rowMapperSchema.AddMapping<byte>("PathScaleY", | 45 | rowMapperSchema.AddMapping<byte>("PathScaleY", |
46 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; }, | 46 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; }, |
47 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; }); | 47 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; }); |
48 | 48 | ||
49 | rowMapperSchema.AddMapping<byte>("PathShearX", | 49 | rowMapperSchema.AddMapping<byte>("PathShearX", |
50 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; }, | 50 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; }, |
51 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; }); | 51 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; }); |
52 | 52 | ||
53 | rowMapperSchema.AddMapping<byte>("PathShearY", | 53 | rowMapperSchema.AddMapping<byte>("PathShearY", |
54 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; }, | 54 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; }, |
55 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; }); | 55 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; }); |
56 | 56 | ||
57 | rowMapperSchema.AddMapping<ushort>("ProfileBegin", | 57 | rowMapperSchema.AddMapping<ushort>("ProfileBegin", |
58 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; }, | 58 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; }, |
59 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; }); | 59 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; }); |
60 | 60 | ||
61 | rowMapperSchema.AddMapping<ushort>("ProfileEnd", | 61 | rowMapperSchema.AddMapping<ushort>("ProfileEnd", |
62 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; }, | 62 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; }, |
63 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; }); | 63 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; }); |
64 | 64 | ||
65 | rowMapperSchema.AddMapping<LLVector3>("Scale", | 65 | rowMapperSchema.AddMapping<LLVector3>("Scale", |
66 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; }, | 66 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; }, |
67 | delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; }); | 67 | delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; }); |
68 | 68 | ||
69 | rowMapperSchema.AddMapping<sbyte>("PathTaperX", | 69 | rowMapperSchema.AddMapping<sbyte>("PathTaperX", |
70 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; }, | 70 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; }, |
71 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; }); | 71 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; }); |
72 | 72 | ||
73 | rowMapperSchema.AddMapping<sbyte>("PathTaperY", | 73 | rowMapperSchema.AddMapping<sbyte>("PathTaperY", |
74 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; }, | 74 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; }, |
75 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; }); | 75 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; }); |
76 | 76 | ||
77 | rowMapperSchema.AddMapping<sbyte>("PathTwist", | 77 | rowMapperSchema.AddMapping<sbyte>("PathTwist", |
78 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; }, | 78 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; }, |
79 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; }); | 79 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; }); |
80 | 80 | ||
81 | rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset", | 81 | rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset", |
82 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; }, | 82 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; }, |
83 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; }); | 83 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; }); |
84 | 84 | ||
85 | rowMapperSchema.AddMapping<byte>("PathRevolutions", | 85 | rowMapperSchema.AddMapping<byte>("PathRevolutions", |
86 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; }, | 86 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; }, |
87 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; }); | 87 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; }); |
88 | 88 | ||
89 | rowMapperSchema.AddMapping<sbyte>("PathTwistBegin", | 89 | rowMapperSchema.AddMapping<sbyte>("PathTwistBegin", |
90 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; }, | 90 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; }, |
91 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; }); | 91 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; }); |
92 | 92 | ||
93 | rowMapperSchema.AddMapping<byte>("PathCurve", | 93 | rowMapperSchema.AddMapping<byte>("PathCurve", |
94 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; }, | 94 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; }, |
95 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; }); | 95 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; }); |
96 | 96 | ||
97 | rowMapperSchema.AddMapping<byte>("ProfileCurve", | 97 | rowMapperSchema.AddMapping<byte>("ProfileCurve", |
98 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; }, | 98 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; }, |
99 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; }); | 99 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; }); |
100 | 100 | ||
101 | rowMapperSchema.AddMapping<ushort>("ProfileHollow", | 101 | rowMapperSchema.AddMapping<ushort>("ProfileHollow", |
102 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; }, | 102 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; }, |
103 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; }); | 103 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; }); |
104 | 104 | ||
105 | rowMapperSchema.AddMapping<byte[]>("TextureEntry", | 105 | rowMapperSchema.AddMapping<byte[]>("TextureEntry", |
106 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; }, | 106 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; }, |
107 | delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; }); | 107 | delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; }); |
108 | 108 | ||
109 | rowMapperSchema.AddMapping<byte[]>("ExtraParams", | 109 | rowMapperSchema.AddMapping<byte[]>("ExtraParams", |
110 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; }, | 110 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; }, |
111 | delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; }); | 111 | delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; }); |
112 | } | 112 | } |
113 | 113 | ||
114 | public override PrimitiveBaseShapeRowMapper FromReader(DataReader reader) | 114 | public override PrimitiveBaseShapeRowMapper FromReader(DataReader reader) |
115 | { | 115 | { |
116 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | 116 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); |
117 | 117 | ||
118 | PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape); | 118 | PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape); |
119 | mapper.FillObject( reader ); | 119 | mapper.FillObject( reader ); |
120 | 120 | ||
121 | return mapper; | 121 | return mapper; |
122 | } | 122 | } |
123 | 123 | ||
124 | public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) | 124 | public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) |
125 | { | 125 | { |
126 | PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape); | 126 | PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape); |
127 | return Update(sceneObjectPartId, mapper); | 127 | return Update(sceneObjectPartId, mapper); |
128 | } | 128 | } |
129 | 129 | ||
130 | public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) | 130 | public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) |
131 | { | 131 | { |
132 | PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape); | 132 | PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape); |
133 | return Add(mapper); | 133 | return Add(mapper); |
134 | } | 134 | } |
135 | 135 | ||
136 | private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) | 136 | private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) |
137 | { | 137 | { |
138 | PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape ); | 138 | PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape ); |
139 | mapper.SceneObjectPartId = sceneObjectPartId; | 139 | mapper.SceneObjectPartId = sceneObjectPartId; |
140 | return mapper; | 140 | return mapper; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } \ No newline at end of file | 143 | } \ No newline at end of file |