aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs')
-rw-r--r--OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs170
1 files changed, 0 insertions, 170 deletions
diff --git a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs
deleted file mode 100644
index 51adf89..0000000
--- a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs
+++ /dev/null
@@ -1,170 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenSim.Framework;
30using OpenSim.Framework.Data.Base;
31using libsecondlife;
32
33namespace OpenSim.Framework.Data
34{
35 public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
36 {
37 public Guid SceneObjectPartId;
38
39 public PrimitiveBaseShapeRowMapper(BaseSchema schema, PrimitiveBaseShape obj) : base(schema, obj)
40 {
41 }
42 }
43
44 public class PrimitiveBaseShapeTableMapper : OpenSimTableMapper<PrimitiveBaseShapeRowMapper, Guid>
45 {
46 public PrimitiveBaseShapeTableMapper(BaseDatabaseConnector connection, string tableName)
47 : base(connection, tableName)
48 {
49 BaseSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new BaseSchema<PrimitiveBaseShapeRowMapper>(this);
50 m_schema = rowMapperSchema;
51
52 m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId",
53 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; },
54 delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; });
55
56 rowMapperSchema.AddMapping<byte>("PCode",
57 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; },
58 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; });
59
60 rowMapperSchema.AddMapping<ushort>("PathBegin",
61 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; },
62 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; });
63
64 rowMapperSchema.AddMapping<ushort>("PathEnd",
65 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; },
66 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; });
67
68 rowMapperSchema.AddMapping<byte>("PathScaleX",
69 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; },
70 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; });
71
72 rowMapperSchema.AddMapping<byte>("PathScaleY",
73 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; },
74 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; });
75
76 rowMapperSchema.AddMapping<byte>("PathShearX",
77 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; },
78 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; });
79
80 rowMapperSchema.AddMapping<byte>("PathShearY",
81 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; },
82 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; });
83
84 rowMapperSchema.AddMapping<ushort>("ProfileBegin",
85 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; },
86 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; });
87
88 rowMapperSchema.AddMapping<ushort>("ProfileEnd",
89 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; },
90 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; });
91
92 rowMapperSchema.AddMapping<LLVector3>("Scale",
93 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; },
94 delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; });
95
96 rowMapperSchema.AddMapping<sbyte>("PathTaperX",
97 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; },
98 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; });
99
100 rowMapperSchema.AddMapping<sbyte>("PathTaperY",
101 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; },
102 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; });
103
104 rowMapperSchema.AddMapping<sbyte>("PathTwist",
105 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; },
106 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; });
107
108 rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset",
109 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; },
110 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; });
111
112 rowMapperSchema.AddMapping<byte>("PathRevolutions",
113 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; },
114 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; });
115
116 rowMapperSchema.AddMapping<sbyte>("PathTwistBegin",
117 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; },
118 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; });
119
120 rowMapperSchema.AddMapping<byte>("PathCurve",
121 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; },
122 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; });
123
124 rowMapperSchema.AddMapping<byte>("ProfileCurve",
125 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; },
126 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; });
127
128 rowMapperSchema.AddMapping<ushort>("ProfileHollow",
129 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; },
130 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; });
131
132 rowMapperSchema.AddMapping<byte[]>("TextureEntry",
133 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; },
134 delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; });
135
136 rowMapperSchema.AddMapping<byte[]>("ExtraParams",
137 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; },
138 delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; });
139 }
140
141 public override PrimitiveBaseShapeRowMapper FromReader(BaseDataReader reader)
142 {
143 PrimitiveBaseShape shape = new PrimitiveBaseShape();
144
145 PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape);
146 mapper.FillObject( reader );
147
148 return mapper;
149 }
150
151 public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
152 {
153 PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
154 return Update(sceneObjectPartId, mapper);
155 }
156
157 public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
158 {
159 PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
160 return Add(mapper);
161 }
162
163 private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
164 {
165 PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape );
166 mapper.SceneObjectPartId = sceneObjectPartId;
167 return mapper;
168 }
169 }
170}