123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using OpenMetaverse;
- using OpenSim.Framework;
- namespace OpenSim.Data
- {
- public class RegionData
- {
- public UUID RegionID;
- public UUID ScopeID;
- public string RegionName;
-
-
-
- public int posX;
-
-
-
- public int posY;
- public int sizeX;
- public int sizeY;
-
-
-
- public int coordX { get { return posX / (int)Constants.RegionSize; } }
-
-
-
- public int coordY { get { return posY / (int)Constants.RegionSize; } }
- public Dictionary<string, object> Data;
- }
-
-
-
- public interface IRegionData
- {
- RegionData Get(UUID regionID, UUID ScopeID);
- List<RegionData> Get(string regionName, UUID ScopeID);
- RegionData Get(int x, int y, UUID ScopeID);
- List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
- bool Store(RegionData data);
- bool SetDataItem(UUID principalID, string item, string value);
- bool Delete(UUID regionID);
- List<RegionData> GetDefaultRegions(UUID scopeID);
- List<RegionData> GetDefaultHypergridRegions(UUID scopeID);
- List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
- List<RegionData> GetHyperlinks(UUID scopeID);
- }
- public class RegionDataDistanceCompare : IComparer<RegionData>
- {
- private Vector2 m_origin;
- public RegionDataDistanceCompare(int x, int y)
- {
- m_origin = new Vector2(x, y);
- }
- public int Compare(RegionData regionA, RegionData regionB)
- {
- Vector2 vectorA = new Vector2(regionA.posX, regionA.posY);
- Vector2 vectorB = new Vector2(regionB.posX, regionB.posY);
- return Math.Sign(VectorDistance(m_origin, vectorA) - VectorDistance(m_origin, vectorB));
- }
- private float VectorDistance(Vector2 x, Vector2 y)
- {
- return (x - y).Length();
- }
- }
- }
|