private FeatureActivationAttribute CreateAttribute(FeatureTypes validLicense, FeatureTypes requiredLicense)
        {
            var featureLicenseHelperMock = new Mock <IFeatureLicenseHelper>(MockBehavior.Strict);

            featureLicenseHelperMock.Setup(i => i.GetValidBlueprintLicenseFeatures()).Returns(validLicense);
            return(new FeatureActivationAttribute(requiredLicense, featureLicenseHelperMock.Object));
        }
示例#2
0
    //

    void CreateMapFeature(FeatureTypes featureType, MapCoor center)
    {
        string[] mapFeature;

        switch (featureType)
        {
        case (FeatureTypes.FOREST_CIRCLE):
            mapFeature = MapFeatures.forestCircle;
            break;

        default:
            mapFeature = MapFeatures.forestCircle;
            break;
        }

        MapCoor featureCenter = new MapCoor(mapFeature[0].Length / 2, mapFeature.Length / 2);

        for (int row = 0; row < mapFeature.Length; row++)
        {
            char[] rowOfChars = mapFeature[row].ToCharArray();
            for (int col = 0; col < rowOfChars.Length; col += 3)
            {
                if (rowOfChars[col] == ' ')
                {
                    SetTile(1, new MapCoor(center.x + col / 3, center.y + row), '\0');
                }
                else
                {
                    SetTile(1, new MapCoor(center.x + col / 3, center.y + row), rowOfChars[col]);
                }
            }
        }
    }
        private string GetEncryptedLicense(FeatureTypes feature, DateTime expiration)
        {
            var license = new[] { new FeatureInformation(FeatureInformation.Features.Single(p => p.Value == feature).Key, expiration) };
            var xml     = SerializationHelper.ToXml(license);

            return(SystemEncryptions.Encrypt(xml));
        }
示例#4
0
 public Follower(double x, double y, FeatureTypes featureType, int featureNumber)
 {
     X             = x;
     Y             = y;
     FeatureType   = featureType;
     FeatureNumber = featureNumber;
 }
        /// <summary>
        /// Initialises the new instance with the mesh to work with and the base instance to interact with PowerShape.
        /// The feature type to recognise is set to plane.
        /// </summary>
        /// <param name="mesh">The mesh to fit a surface to.</param>
        /// <remarks></remarks>
        public ManualFitSurfaceToMeshTool(PSMesh mesh)
        {
            _mesh                   = mesh;
            _powershape             = mesh.PowerSHAPE;
            _trianglePicker         = new PSMeshTrianglePicker(mesh);
            _featureTypeToRecognise = FeatureTypes.Plane;

            // Only chose this because Powershape defaults to Plane
        }
示例#6
0
        public static Feature CreateFeature(FeatureTypes type, IntVector2 worldPosition)
        {
            if (!Instance._features.TryGetValue(type, out var featureObject))
            {
                _log.Error($"Could not find an object for featureType `{type}.");
            }

            featureObject = Instantiate(featureObject);
            featureObject.transform.position = worldPosition;

            var feature = featureObject.GetComponent <Feature>();

            featureObject.name = feature.ObjectName;

            _log.ErrorIfNull(feature, $"Block of type {type} has not been given a 'feature' component.");

            return(feature);
        }
示例#7
0
    //

    void CreateMapFeature(FeatureCenterPair fcp)
    {
        FeatureTypes featureType = fcp.featureType;
        MapCoor      center      = fcp.center;

        string[] mapFeature = MapFeatures.GetFeature(featureType);

        int layer = 1;

        if (fcp.featureType == FeatureTypes.CASTLE)
        {
            layer = 2;
        }
        if (fcp.mirrored)
        {
            string[] copy = mapFeature;

            for (int i = 0; i < copy.Length; i++)
            {
                mapFeature[i] = new string(mapFeature[i].ToCharArray().Reverse().ToArray());
                for (int j = 0; j < copy[0].Length; j += 3)
                {
                    // mapFeature[i].ToCharArray()[j] = copy[i].ToCharArray()[copy[0].Length - j - 1];
                }
            }
        }

        for (int row = 0; row < mapFeature.Length; row++)
        {
            char[] rowOfChars = mapFeature[row].ToCharArray();
            for (int col = 0; col < rowOfChars.Length; col += 3)
            {
                if (rowOfChars[col] == ' ')
                {
                    SetTile(layer, new MapCoor(center.x + col / 3, center.y + row), '\0');
                }
                else
                {
                    SetTile(layer, new MapCoor(center.x + col / 3, center.y + row),
                            rowOfChars[col]);
                }
            }
        }
    }
    public static string[] GetFeature(FeatureTypes featureType)
    {
        switch (featureType)
        {
        case (FeatureTypes.FOREST_CIRCLE):
            return(MapFeatures.forestCircle);

        case (FeatureTypes.DARK_FOREST):
            return(MapFeatures.darkForest);

        case (FeatureTypes.AIRSHIP_SALESMAN):
            return(MapFeatures.airshipSalesman);

        case (FeatureTypes.CASTLE):
            return(MapFeatures.castle);

        default:
            return(MapFeatures.forestCircle);
        }
    }
        /// <summary>
        /// Updates PowerShape with the feature type to recognise.
        /// </summary>
        /// <param name="type">The feature type to recognise.</param>
        /// <remarks></remarks>
        private void RecogniseType(FeatureTypes type)
        {
            switch (type)
            {
            case FeatureTypes.Cone:
                _powershape.DoCommand("Primtype Cone");
                break;

            case FeatureTypes.Cylinder:
                _powershape.DoCommand("Primtype Cylinder");
                break;

            case FeatureTypes.Extrusion:
                _powershape.DoCommand("Primtype Extrusion");
                break;

            case FeatureTypes.Plane:
                _powershape.DoCommand("Primtype Plane");
                break;

            case FeatureTypes.RevolvedSurface:
                _powershape.DoCommand("Primtype Revolution");
                break;

            case FeatureTypes.ShrinkWrap:
                _powershape.DoCommand("Primtype ShrinkWrap");
                break;

            case FeatureTypes.Sphere:
                _powershape.DoCommand("Primtype Sphere");
                break;

            case FeatureTypes.Tori:
                _powershape.DoCommand("Primtype Torus");
                break;
            }
        }
示例#10
0
        /// <summary>
        /// This creates a new featureset by checking each row of the table.  If the WKB feature
        /// type matches the specifeid featureTypes, then it will copy that.
        /// </summary>
        /// <param name="wkbTable"></param>
        /// <param name="wkbColumnIndex"></param>
        /// <param name="indexed"></param>
        /// <param name="type"></param>
        public FeatureSet(DataTable wkbTable, int wkbColumnIndex, bool indexed, FeatureTypes type)
        {
            if(_indexMode)
            {
                // Assume this DataTable has WKB in column[0] and the rest of the columns are attributes.
                FeatureSetPack result = new FeatureSetPack();
                foreach (DataRow row in wkbTable.Rows)
                {
                    byte[] data = (byte[])row[0];
                    MemoryStream ms = new MemoryStream(data);
                    WkbFeatureReader.ReadFeature(ms, result);
                }
                // convert lists of arrays into a single vertex array for each shape type.
                result.StopEditing();
                // Make sure all the same columns exist in the same order
                result.Polygons.CopyTableSchema(wkbTable);
                // Assume that all the features happend to be polygons
                foreach (DataRow row in wkbTable.Rows)
                {
                    // Create a new row
                    DataRow dest = result.Polygons.DataTable.NewRow();
                    // 
                    dest.ItemArray = row.ItemArray;

                }
                
            }
            
        }
示例#11
0
	void OnGUI(){
		EditorStyles.textField.wordWrap = true;
		Repaint();
		Rect OldRect = position;
		OldRect.width=320;
		OldRect.height=450;
		if (position.width>320||position.height>450)
		position = OldRect;
		maximized = false;
		GUISkin oldskin = GUI.skin;
		Vector2 WinSize = new Vector2(position.width,position.height);
		if(Event.current.type==EventType.Repaint)
		ShaderUtil.AddProSkin(WinSize);
		
		if (!Feature)
		GUI.Toggle(new Rect(10,10,(WinSize.x-20)/2,30),true,"Report Bug",GUI.skin.GetStyle("ButtonLeft"));
		else
		if (GUI.Button(new Rect(10,10,(WinSize.x-20)/2,30),"Report Bug",GUI.skin.GetStyle("ButtonLeft")))
			Feature = false;
			
		if (Feature)
		GUI.Toggle(new Rect(10+(WinSize.x-20)/2,10,(WinSize.x-20)/2,30),true,"Suggest Feature",GUI.skin.GetStyle("ButtonLeft"));
		else
		if (GUI.Button(new Rect(10+(WinSize.x-20)/2,10,(WinSize.x-20)/2,30),"Suggest Feature",GUI.skin.GetStyle("ButtonLeft")))
			Feature = true;
		
		int YOffset = 40;
		GUI.Box(new Rect(5,YOffset,WinSize.x-10,WinSize.y-20),"","Button");
		if (!Feature){
			
			GUI.Label(new Rect(10,YOffset+0,WinSize.x-20,100),"Oh no, you've found a bug! Sorry about this, but here's how you can help. Just check a few options and hit send to help Shader Sandwich become even more awesome :).");
			
			GUI.Label(new Rect(10,YOffset+70,WinSize.x-20,20),"Name of the bug:");
			BName = GUI.TextField(new Rect(10,YOffset+90,WinSize.x-20,20),BName);
			YOffset+=50;
			GUI.Label(new Rect(10,YOffset+70,WinSize.x-20,20),"Whats wrong?");
			Error = (ErrorTypes)EditorGUI.IntPopup(new Rect(110,YOffset+70,WinSize.x-120,15),(int)Error,new string[]{"The shaders pink!","Something isn't doing what I expect.","Something else."},new int[]{0,1,2},ShaderUtil.EditorPopup);
			//EditorGUI.TextField(new Rect(0,60,WinSize.x-10,20),"ASD");
			GUI.Label(new Rect(10,YOffset+95,WinSize.x-20,20),"Got any details you think are important?");
			GUI.SetNextControlName("Context");
			//Debug.Log((GUI.GetNameOfFocusedControl()!="Context"&&Context==" ")?("Then type them here!"+UnityEngine.Random.value.ToString()):Context);
			string Con = EditorGUI.TextArea(new Rect(10, YOffset+120, WinSize.x-20, 90), (!EditingContext)?("Then type them here!"):BContext, GUI.skin.textArea);
			if (GUI.GetNameOfFocusedControl()!="Context"&&BContext==""){
			//	EditorGUI.TextArea(new Rect(0, 110, WinSize.x-20, 100), "Then type them here!", GUI.skin.textField);
//				InArea = 0;
			}
			else{
				if (!EditingContext){
					GUI.FocusControl("");
				}
				EditingContext = true;
			}
			if (EditingContext){
				if (!Refocused&&Event.current.type==EventType.Repaint){
					Refocused = true;
					GUI.FocusControl("Context");
				}
				if (Refocused)
				BContext = Con;
			}
			YOffset-=10;
			GUIStyle ButtonStyle = new GUIStyle(GUI.skin.button);
			ButtonStyle.padding = new RectOffset(0,0,0,0);
			ButtonStyle.margin = new RectOffset(0,0,0,0);
			GUI.Label(new Rect(10, YOffset+220, WinSize.x-20, 20),"Your email address:");
			YOffset+=20;
			BEmail = GUI.TextField(new Rect(10, YOffset+220, WinSize.x-20, 20),BEmail);
			YOffset+=30;
			GUI.Label(new Rect(10, YOffset+220, WinSize.x-20, 20),"Include current shader (Please do!)");
			Rect rect = new Rect(WinSize.x-30, YOffset+220, 20, 20);
			if (IncludeCurrentShader)
				IncludeCurrentShader = GUI.Toggle(rect,IncludeCurrentShader,ShaderSandwich.Tick,ButtonStyle);
				else
				IncludeCurrentShader = GUI.Toggle(rect,IncludeCurrentShader,ShaderSandwich.Cross,ButtonStyle);
				
			YOffset+=25;
			GUI.Label(new Rect(10, YOffset+220, WinSize.x-20, 20),"Make the bug private");
			rect = new Rect(WinSize.x-30, YOffset+220, 20, 20);
			if (Private)
				Private = GUI.Toggle(rect,Private,ShaderSandwich.Tick,ButtonStyle);
				else
				Private = GUI.Toggle(rect,Private,ShaderSandwich.Cross,ButtonStyle);
			//Private=false;
			
		}
		if (Feature){
			
			GUI.Label(new Rect(10,YOffset+0,WinSize.x-20,100),"So, you think you've got a cool idea for a feature? Well tell us about it, and we might add it in!");
			GUI.Label(new Rect(10,YOffset+70,WinSize.x-20,20),"Name of the feature:");
			FName = GUI.TextField(new Rect(10,YOffset+90,WinSize.x-20,20),FName);
			YOffset+=50;
			
			GUI.Label(new Rect(10,YOffset+70,WinSize.x-20,20),"How important is this feature to you?");
			YOffset+=20;
			FeatureImportance = (FeatureTypes)EditorGUI.IntPopup(new Rect(10,YOffset+70,WinSize.x-80,15),(int)FeatureImportance,new string[]{"I can wait ages for it.","It would come in handy soon.","I really need it for the shader I'm making!"},new int[]{0,1,2},ShaderUtil.EditorPopup);
			//EditorGUI.TextField(new Rect(0,60,WinSize.x-10,20),"ASD");
			GUI.Label(new Rect(10,YOffset+95,WinSize.x-20,20),"So whats your cool idea? Please use detail :).");
			//Debug.Log((GUI.GetNameOfFocusedControl()!="Context"&&Context==" ")?("Then type them here!"+UnityEngine.Random.value.ToString()):Context);
			string Con = EditorGUI.TextArea(new Rect(10, YOffset+120, WinSize.x-20, 100), FContext, GUI.skin.textArea);
			FContext = Con;
			
			GUI.Label(new Rect(10, YOffset+220, WinSize.x-20, 20),"Your email address:");
			YOffset+=20;
			BEmail = GUI.TextField(new Rect(10, YOffset+220, WinSize.x-20, 20),BEmail);
			YOffset+=30;			
		}
		if (GUI.Button(new Rect(10,WinSize.y-50,100,40),"Submit!")){
			int Option = 0;
			if (!Feature)
			Option = EditorUtility.DisplayDialog("Ready?","Cool, your bug report is about to be submitted. Along with it will be some system info like \nUnity "+Application.unityVersion+"\n"
			+SystemInfo.operatingSystem+"\n"
			+SystemInfo.deviceModel+"\n"
+SystemInfo.graphicsDeviceName+"\nSM"+
(SystemInfo.graphicsShaderLevel/10).ToString()+"\n\n"+
"This stuff is important for fixing the bug, so if that's ok just click \"Go Ahead\"!","Go ahead!","Sorry, not yet.")?0:1;
			if (Feature)
			Option = EditorUtility.DisplayDialogComplex("Ready?","Cool, your feature idea is about to be submitted. If you want you can also submit some system info like \nUnity "+Application.unityVersion+"\n"
			+SystemInfo.operatingSystem+"\n"
			+SystemInfo.deviceModel+"\n"
+SystemInfo.graphicsDeviceName+"\nSM"+
(SystemInfo.graphicsShaderLevel/10).ToString()+"\n\n"+
"This is useful to me for statistical purposes and stuff, but if you want you can choose not to submit it.","Submit with data!","Don't submit yet.","Submit without data.");
			if (Option==0||Option==2){
				WWWForm form = new WWWForm();
				WWW www;
				if (!Feature){
					form.AddField("SSV", "1.2");//[email protected]
					form.AddField("Email", BEmail);//[email protected]
					form.AddField("Unity", Application.unityVersion);//Unity 5.02f
					form.AddField("OS", SystemInfo.operatingSystem);//Windows 7
					form.AddField("CPU", SystemInfo.deviceModel);//Intel(R)
					form.AddField("CName", "Nup");//SystemInfo.deviceName);//IMACATLOL-HP
					form.AddField("Name", BName);
					form.AddField("GPU", SystemInfo.graphicsDeviceName);//NVIDIA
					form.AddField("CID", SystemInfo.deviceUniqueIdentifier);//1fe8504986mgf003sfbtrt
					form.AddField("ShaderModel", (SystemInfo.graphicsShaderLevel/10).ToString());//3
					if (IncludeCurrentShader&&ShaderSandwich.Instance!=null&&ShaderSandwich.Instance.OpenShader!=null){
						string GenStr = "";
						try {
							GenStr = ShaderSandwich.Instance.OpenShader.GenerateCode(true);
						}
						catch{}
						form.AddField("File",GenStr+"\n\n/*\n"+ShaderSandwich.Instance.OpenShader.Save()+"\n*/");
					}
					else
					if (ShaderSandwich.Instance==null||ShaderSandwich.Instance.OpenShader==null){
						form.AddField("File", "Couldn't");
					}
					else
					if (ShaderSandwich.Instance!=null&&ShaderSandwich.Instance.OpenShader!=null){
						form.AddField("File", "Nup");
					}
					form.AddField("Private", Private ? "1":"0");
					form.AddField("Attr", Error.ToString());
					form.AddField("Context", BContext);
					form.AddField("Type", "Bug");
				}
				else{
					if (Option==0){
						form.AddField("SSV", "1.2");
						form.AddField("Email", BEmail);//[email protected]
						form.AddField("Unity", Application.unityVersion);//Unity 5.02f
						form.AddField("OS", SystemInfo.operatingSystem);//Windows 7
						form.AddField("CPU", SystemInfo.deviceModel);//Intel(R)
						form.AddField("CName", "Nup");//SystemInfo.deviceName);//IMACATLOL-HP
						form.AddField("Name", FName);
						form.AddField("GPU", SystemInfo.graphicsDeviceName);//NVIDIA
						form.AddField("CID", SystemInfo.deviceUniqueIdentifier);//1fe8504986mgf003sfbtrt
						form.AddField("ShaderModel", (SystemInfo.graphicsShaderLevel/10).ToString());//3
						//form.AddField("Private", Private ? "1":"0");
						form.AddField("Attr", FeatureImportance.ToString());
						form.AddField("Context", FContext);
						form.AddField("Type", "Feature");
					}
					if (Option==2){
						form.AddField("SSV", "1.2");
						form.AddField("Email", BEmail);//[email protected]
						form.AddField("Unity", "Nup");//Unity 5.02f
						form.AddField("OS", "Nup");//Unity 5.02f
						form.AddField("CPU", "Nup");//Intel(R)
						form.AddField("CName", "Nup");//SystemInfo.deviceName);//IMACATLOL-HP
						form.AddField("Name", FName);
						form.AddField("GPU", "Nup");//NVIDIA
						form.AddField("CID", "Nup");//1fe8504986mgf003sfbtrt
						form.AddField("ShaderModel", "Nup");//3
						//form.AddField("Private", Private ? "1":"0");
						form.AddField("Attr", FeatureImportance.ToString());
						form.AddField("Context", FContext);
						form.AddField("Type", "Feature");
					}
					
				}
				www = new WWW("http://electronic-mind.org/scripts/SSFeedbackReport.php", form);
				
				double Start = EditorApplication.timeSinceStartup;
				while (!(www.isDone==true||(EditorApplication.timeSinceStartup-Start>15)))
				{
					EditorUtility.DisplayProgressBar("Submitting!","Your "+(Feature?"feature":"bug")+" is now being uploaded!",((float)(EditorApplication.timeSinceStartup-Start))/15f);
				}
				EditorUtility.ClearProgressBar();
				if (www.isDone==true){
					EditorUtility.DisplayDialog("Success!","Ok, I'll take a look at it shortly, you can watch the progress of it on electronic-mind.org in the Shader Sandwich bug/feature area.","Cool!");
					Help.BrowseURL("http://electronic-mind.org/Pages/ShaderSandwichFeedbackView.php?id="+www.text);
				}
				else
				EditorUtility.DisplayDialog("Oops!","Sorry, something went wrong :(. You can try submitting again, or try a bit later. If it's urgent just email me at [email protected] :).","Ok.");
				//Debug.Log( www.text);
			}
		}
		GUI.skin = oldskin;
	}
示例#12
0
 private static Brush GetTerrainBrush(TerrainTypes terrainType, PlotTypes plotType, FeatureTypes featureType, bool isEmpty)
 {
     if (isEmpty) return new SolidColorBrush(Colors.Transparent);
     string key = GetTerrainImageKey(terrainType, plotType, featureType);
     Image img = App.Current.Resources[key] as Image;
     if (img != null) return new ImageBrush(img.Source);
     return new SolidColorBrush(Color.FromRgb(0, 0, 0));
 }
示例#13
0
        /// <summary>
        /// Creates a new class of vector that matches the given filename.
        /// </summary>
        /// <param name="filename">The string filename from which to create a vector.</param>
        /// <param name="featureType">Specifies the type of feature for this vector file</param>
        /// <param name="progHandler">Overrides the default progress handler with the specified progress handler</param>
        /// <returns>An IFeatureSet that allows working with the dataset.</returns>
        public IFeatureSet CreateVector(string filename, FeatureTypes featureType, IProgressHandler progHandler)
        {
            // To Do: Add Customization that allows users to specify which plugins to use in priority order.
            IFeatureSet result;

            // First check for the extension in the preferred plugins list

            string ext = Path.GetExtension(filename);
            if (_preferredProviders.ContainsKey(ext))
            {
                VectorProvider vp = _preferredProviders[ext] as VectorProvider;
                if (vp != null)
                {
                    result = vp.CreateNew(filename, featureType, true, progHandler);
                    if (result != null)
                        return result;
                }
                // if we get here, we found the provider, but it did not succeed in opening the file.
            }

            // Then check the general list of developer specified providers... but not the directory providers

            foreach (IDataProvider dp in _dataProviders)
            {
                if (GetSupportedExtensions(dp.DialogReadFilter).Contains(ext))
                {
                    VectorProvider vp = dp as VectorProvider;
                    if (vp != null)
                    {
                        // attempt to open with the filename.
                        result = vp.CreateNew(filename, featureType, true, progHandler);
                        if (result != null)
                            return result;
                    }
                }
            }
            MessageBox.Show(MessageStrings.FileTypeNotSupported);
            return null;
        }
示例#14
0
 public InstantStatModFeature(float amount, StatTypes stat, FeatureTypes type)
     : base(amount, stat, type)
 {
 }
示例#15
0
 /// <summary>
 /// Creates a new shapefile that has a specific feature type
 /// </summary>
 /// <param name="featureType"></param>
 protected Shapefile(FeatureTypes featureType) : base(featureType)
 {
 }
 /// <summary>
 /// Attempts to read in an entry to the specified feature type.  If the feature type does not match
 /// the geometry type, this will return null.  (A Point geometry will be accepted by MultiPoint 
 /// feature type, but not the other way arround.  Either way, this will advance the reader
 /// through the shape feature.  Using the Unspecified will always return the shape it reads,
 /// or null in the case of mixed feature collections which are not supported.
 /// </summary>
 /// <param name="data"></param>
 /// <param name="featureType"></param>
 /// <returns></returns>
 public static Shape ReadShape(Stream data, FeatureTypes featureType)
 {
     _endian = (ByteOrder)data.ReadByte();
     WkbGeometryTypes type = (WkbGeometryTypes)ReadInt32(data);
     Shape result;
     switch (type)
     {
         case WkbGeometryTypes.Point:
             result = ReadPoint(data);
             if (featureType == FeatureTypes.Point || featureType == FeatureTypes.MultiPoint || featureType == FeatureTypes.Unspecified)
             {
                 return result;
             }
             return null;
         case WkbGeometryTypes.LineString:
             result = ReadLineString(data);
             if (featureType == FeatureTypes.Line || featureType == FeatureTypes.Unspecified)
             {
                 return result;
             }
             return null;
         case WkbGeometryTypes.Polygon:
             result = ReadPolygon(data);
             if (featureType == FeatureTypes.Polygon || featureType == FeatureTypes.Unspecified)
             {
                 return result;
             }
             return null;
         case WkbGeometryTypes.MultiPoint:
             result = ReadMultiPoint(data);
             if(featureType == FeatureTypes.MultiPoint || featureType == FeatureTypes.Unspecified )
             {
                 return result;
             }
             return null;
         case WkbGeometryTypes.MultiLineString:
             result = ReadMultiLineString(data);
             if (featureType == FeatureTypes.Line || featureType == FeatureTypes.Unspecified)
             {
                 return result;
             }
             return null;
         case WkbGeometryTypes.MultiPolygon:
             result = ReadMultiPolygon(data);
             if (featureType == FeatureTypes.Polygon || featureType == FeatureTypes.Unspecified)
             {
                 return result;
             }
             return null;
         case WkbGeometryTypes.GeometryCollection:
             throw new ArgumentException("Mixed shape type collections are not supported by this method.");
     }
     return null;
 }
示例#17
0
 public FollowerPoint(double x, double y, FeatureTypes edgeType, int targetNumber)
 {
     X        = x;
     Y        = y;
     EdgeType = edgeType;
 }
示例#18
0
 /// <summary>
 /// This adds the coordinates and specifies what sort of feature type should be added.
 /// </summary>
 /// <param name="self">This IFeatureList</param>
 /// <param name="points">The list or array of coordinates to be added after it is built into the appropriate feature.</param>
 /// <param name="featureType">The feature type.</param>
 public static void Add(this IFeatureList self, IEnumerable<Coordinate> points, FeatureTypes featureType)
 {
     if (self.Parent.FeatureType == FeatureTypes.Unspecified) self.Parent.FeatureType = featureType;
     self.Add(points);
 }
 protected Feature(float amount, StatTypes stat, FeatureTypes type)
 {
     this.Amount = amount;
     this.Stat   = stat;
     this.Type   = type;
 }
示例#20
0
 public SerializableFeature(Feature feature)
 {
     _type     = feature.Type;
     _position = feature.Position;
 }
示例#21
0
 public void AddFeature(IntVector2 position, FeatureTypes type) => _features[position] = type;
示例#22
0
 internal FeatureActivationAttribute(FeatureTypes requiredFeatureTypes, IFeatureLicenseHelper featureLicenseHelper)
 {
     _requiredFeatureTypes = requiredFeatureTypes;
     _featureLicenseHelper = featureLicenseHelper;
 }
示例#23
0
        // TODO: framework for checking if the feature values are mmeting requirements.
        /// <summary> Adds feature(column) to the feature representation. </summary>
        /// <param name="isSparse">
        /// It doesn't affect the flags, they are always sparse.
        /// </param>
        public void AddFeature(
            float[] values, InputFeatureTypes type,
            bool isSparse = false)
        {
            FeatureTypes.Add(type);
            var sIndices = new List <int>();

            if (InstancesCount != 0)
            {
                if (InstancesCount != values.Length)
                {
                    throw new ArgumentException("The feature length is different than instances count.");
                }
            }
            else
            {
                InstancesCount = values.Length;
            }

            switch (type)
            {
            case InputFeatureTypes.Ordinal:
                if (IsSortedDataset)
                {
                    if (isSparse)
                    {
                        SortSparseInput(
                            values,
                            out var nonZeroSortedValues,
                            out var nonZeroSortedIndices,
                            out var negCount);

                        Features.Add(new SparseFeature(
                                         values: nonZeroSortedValues,
                                         sortedIndices: nonZeroSortedIndices,
                                         length: values.Length,
                                         scopeOffset: 0,
                                         scopeCount: nonZeroSortedIndices.Length,
                                         negCount: negCount));
                        break;
                    }
                    else
                    {
                        var sortedIndices = new int[values.Length];
                        for (var i = 0; i < values.Length; i++)
                        {
                            sortedIndices[i] = i;
                        }
                        Array.Sort(values, sortedIndices);
                        Features.Add(new DenseFeature(values, sortedIndices, 0, values.Length));
                        break;
                    }
                }
                if (isSparse)
                {
                    var sValues = new List <float>();
                    for (var i = 0; i < values.Length; i++)
                    {
                        if (values[i] > 0f)
                        {
                            sValues.Add(values[i]);
                            sIndices.Add(i);
                        }
                    }
                    Features.Add(new SparseFeature(
                                     values: sValues.ToArray(),
                                     sortedIndices: sIndices.ToArray(),// Not sorted case;
                                     length: values.Length,
                                     scopeOffset: 0,
                                     scopeCount: sIndices.Count,
                                     negCount: -1));// Not sorted case;
                    break;
                }
                var copiedValues = new float[values.Length];
                Array.Copy(values, copiedValues, values.Length);

                Features.Add(new DenseFeature(values));
                break;

            case InputFeatureTypes.Flags:
                for (var i = 0; i < values.Length; i++)
                {
                    if (values[i] > 0f)
                    {
                        sIndices.Add(i);
                    }
                }
                Features.Add(new BinaryFeature(sIndices.ToArray(), values.Length, 0, sIndices.Count));
                break;
            }
        }
示例#24
0
 /// <summary>
 /// Creates a new class of vector that matches the given filename.
 /// </summary>
 /// <param name="filename">The string filename from which to create a vector.</param>
 /// <param name="featureType">Specifies the type of feature for this vector file</param>
 /// <returns>An IFeatureSet that allows working with the dataset.</returns>
 public IFeatureSet CreateVector(string filename, FeatureTypes featureType)
 {
     return CreateVector(filename, featureType, _progressHandler);
 }
示例#25
0
 /// <summary>
 /// StartRange, count and vertices will be declared later.
 /// </summary>
 /// <param name="featureType"></param>
 public PartRange(FeatureTypes featureType)
 {
     _featureType = featureType;
 }
示例#26
0
 public void SetupLicenseHelperMock(FeatureTypes featureTypes = FeatureTypes.None)
 {
     _licenseHelperMock
     .Setup(l => l.GetValidBlueprintLicenseFeatures())
     .Returns(featureTypes);
 }
示例#27
0
 /// <summary>
 /// Creates a blank instance of a shaperange where vertices can be assigned later.
 /// </summary>
 public ShapeRange(FeatureTypes type)
 {
     FeatureType = type;
     Parts = new List<PartRange>();
     _numParts = -1; // default to relying on the parts list instead of the cached value.
     _numPoints = -1; // rely on accumulation from parts instead of a solid number
 }
示例#28
0
 private static string GetTerrainImageKey(TerrainTypes terrainType, PlotTypes plotType, FeatureTypes featureType)
 {
     if (plotType == PlotTypes.PEAK)
         return "PEAK";
     else if (featureType == FeatureTypes.FEATURE_ICE)
         return "ICE";
     else if (featureType == FeatureTypes.FEATURE_OASIS)
         return "OASIS";
     string key = "";
     if (featureType == FeatureTypes.FEATURE_JUNGLE)
         key = "JUNGLE";
     else
         key = terrainType.ToString().Replace("TERRAIN_", "");
     if ((terrainType == TerrainTypes.TERRAIN_GRASS || terrainType == TerrainTypes.TERRAIN_PLAINS || terrainType == TerrainTypes.TERRAIN_TUNDRA) && featureType == FeatureTypes.FEATURE_FOREST)
         key += "_FOREST";
     if ((terrainType == TerrainTypes.TERRAIN_GRASS || terrainType == TerrainTypes.TERRAIN_PLAINS || terrainType == TerrainTypes.TERRAIN_TUNDRA || terrainType == TerrainTypes.TERRAIN_SNOW || terrainType == TerrainTypes.TERRAIN_DESERT) && plotType == PlotTypes.HILL)
         key += "_HILL";
     return key;
 }
示例#29
0
        /// <summary>
        /// This creates a polygon shape from an extent. 
        /// </summary>
        /// <param name="ext">The extent to turn into a polygon shape.</param>
        public ShapeRange(Extent ext)
        {
            Extent = ext;
            Parts = new List<PartRange>();
            _numParts = -1;
            // Counter clockwise
            // 1 2
            // 4 3
            double[] coords = new double[8];
            // C1
            coords[0] = ext.XMin;
            coords[1] = ext.YMax;
            // C2
            coords[2] = ext.XMax;
            coords[3] = ext.YMax;
            // C3
            coords[4] = ext.XMax;
            coords[5] = ext.YMin;
            // C4
            coords[6] = ext.XMin;
            coords[7] = ext.YMin;

            FeatureType = FeatureTypes.Polygon;
            ShapeType = ShapeTypes.Polygon;
            PartRange pr = new PartRange(coords, 0,0, FeatureTypes.Polygon);
            pr.NumVertices = 4;
            Parts.Add(pr);
            
        }
示例#30
0
 public static Type ConvertToType(FeatureTypes enumType) => _enumToType[enumType];
示例#31
0
 public FeatureCenterPair(MapCoor center, FeatureTypes featureType)
 {
     this.center      = center;
     this.featureType = featureType;
 }
 public ContinuesStatModFeature(float duration, float interval, float amount, StatTypes stat, FeatureTypes type)
     : base(amount, stat, type)
 {
     Duration = duration;
     Interval = interval;
 }
 /// <summary>
 /// This create new method implies that this provider has the priority for creating a new file.
 /// An instance of the dataset should be created and then returned.  By this time, the filename
 /// will already be checked to see if it exists, and deleted if the user wants to overwrite it.
 /// </summary>
 /// <param name="filename">The string filename for the new instance</param>
 /// <param name="featureType">Point, Line, Polygon etc.  Sometimes this will be specified, sometimes it will be "Unspecified"</param>
 /// <param name="inRam">Boolean, true if the dataset should attempt to store data entirely in ram</param>
 /// <param name="progressHandler">An IProgressHandler for status messages.</param>
 /// <returns>An IRaster</returns>
 public virtual IFeatureSet CreateNew(string filename, FeatureTypes featureType, bool inRam, IProgressHandler progressHandler)
 {
     if (featureType == FeatureTypes.Point)
     {
         PointShapefile ps = new PointShapefile();
         ps.Filename = filename;
         return ps;
     }
     else if (featureType == FeatureTypes.Line)
     {
         LineShapefile ls = new LineShapefile();
         ls.Filename = filename;
         return ls;
     }
     else if (featureType == FeatureTypes.Polygon)
     {
         PolygonShapefile ps = new PolygonShapefile();
         ps.Filename = filename;
         return ps;
     }
     else if (featureType == FeatureTypes.MultiPoint)
     {
         MultiPointShapefile mps = new MultiPointShapefile();
         mps.Filename = filename;
         return mps;
     }
   
     return null;
     
    
 }
示例#34
0
 /// <summary>
 /// Creates a new instance of Part
 /// </summary>
 /// <param name="allVertices">An array of all the vertex locations</param>
 /// <param name="shapeOffset">The point index of the shape. </param>
 /// <param name="partOffset">The ponit index of the part.</param>
 /// <param name="featureType">The type of features.</param>
 public PartRange(double[] allVertices, int shapeOffset, int partOffset , FeatureTypes featureType):
     base(allVertices, shapeOffset, partOffset)
 {
     _segments = new SegmentRange(this, featureType);
     _featureType = featureType;
 }
示例#35
0
 public TempStatModFeature(float duration, float amount, StatTypes stat, FeatureTypes type)
     : base(amount, stat, type)
 {
     Duration = duration;
 }
示例#36
0
        /// <summary>
        /// Creates a new "point" shape that has only the one point.
        /// </summary>
        /// <param name="v"></param>
        public ShapeRange(Vertex v)
        {
            FeatureType = FeatureTypes.Point;
            Parts = new List<PartRange>();
            _numParts = -1;
            double[] coords = new double[2];
            coords[0] = v.X;
            coords[1] = v.Y;
            PartRange prt = new PartRange(coords, 0,0, FeatureTypes.Point);
            prt.NumVertices = 1;
            Parts.Add(prt);

        }
示例#37
0
 /// <summary>
 /// Creates a new shape type where the shaperange exists and has a type specified
 /// </summary>
 /// <param name="type"></param>
 public Shape(FeatureTypes type)
 {
     _shapeRange = new ShapeRange(type);
 }
示例#38
0
 /// <summary>
 /// Creates a new FeatureSet
 /// </summary>
 /// <param name="featureType">The Feature type like point, line or polygon</param>
 public FeatureSet(FeatureTypes featureType) : this()
 {
     _featureType = featureType;
 }
示例#39
0
 public void Fatal(string message, FeatureTypes featureType = FeatureTypes.Default, object[] args = null,
                   [CallerMemberName] string caller         = "")
 {
     UnityEngine.Debug.LogError($"{featureType.ToString().ToUpper()} ({caller}) :: {message}; args: {JoinArgs(args)}");
     // TODO: Add stacktrace
 }
示例#40
0
 public void Warn(string message, FeatureTypes featureType = FeatureTypes.Default, object[] args = null, string caller = "")
 {
     UnityEngine.Debug.LogWarning($"{featureType.ToString().ToUpper()} ({caller}) :: {message}; args: {JoinArgs(args)}");
 }
示例#41
0
 public FeatureActivationAttribute(FeatureTypes requiredFeatureTypes) : this(requiredFeatureTypes, FeatureLicenseHelper.Instance)
 {
 }
示例#42
0
 public FeatureCenterPair(MapCoor center, FeatureTypes featureType, bool mirrored = false)
 {
     this.center      = center;
     this.featureType = featureType;
     this.mirrored    = mirrored;
 }
示例#43
0
 public BlockBuilder SetFeature(FeatureTypes feature)
 {
     _feature = feature;
     return(this);
 }