public override Object get(String name) { if (name == "(none)") { return(null); } if (name[0] == '#') { // if (MyGlobaleVariables.AddUndefinedColor == "#") //MOD if (Properties.Settings.Default.addUndefinedColor == true) //MOD { //MOD add(new sColor(name, Convert.ToUInt32(name.Substring(1), 16))); //MOD return(new sColor(name, Convert.ToUInt32(name.Substring(1), 16))); //MOD } //MOD else //MOD { //MOD add(new sColor(name.Replace("#", "un"), Convert.ToUInt32(name.Substring(1), 16))); //MOD return(new sColor(name.Replace("#", "un"), Convert.ToUInt32(name.Substring(1), 16))); //MOD } //MOD // add(new sColor(name, Convert.ToUInt32(name.Substring(1), 16))); //MOD // return new sColor("undefined", Convert.ToUInt32(name.Substring(1), 16)); // Original // return new sColor(name, Convert.ToUInt32(name.Substring(1), 16)); //MOD } Object col = (Object)pColors[name]; if (col == null) { col = new sColor(name, 0xFF00FF); add(col); } return(col); }
public override String add(Object element) { sColor color = (sColor)element; pColors[color.pName] = color; return(color.pName); }
public Color(uint resId, uint propId, sColor color) { RessourceId = resId; PropertyId = propId; Alpha = color.Alpha; Red = color.Red; Green = color.Green; Blue = color.Blue; }
public override Object[] getArray() { ArrayList colors = new ArrayList(); colors.AddRange(pColors.Values); colors.Sort(); Object[] Aobjects = (Object[])colors.ToArray(); sColor[] Acolors = new sColor[Aobjects.Length]; Aobjects.CopyTo(Acolors, 0); return((Object[])Acolors); }
public void rename(cXMLHandler XmlHandler, String name, String to) { sColor color = (sColor)pColors[name]; remove(color); color.pName = to; add(color); XmlNode Node = XmlHandler.XmlGetRootNodeElement(null); renameColor(Node.ChildNodes, name, to); }
public cDataBaseColor(cXMLHandler XmlHandler) { pColors = new Hashtable(); string[] path = { /*"skin", */ "colors" }; XmlNode colorNode = XmlHandler.XmlGetRootNodeElement(path); foreach (XmlNode myXmlNode in colorNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } String colorString = myXmlNode.Attributes["value"].Value; sColor color; if (colorString[0] == '#') { UInt32 colorValue = Convert.ToUInt32(colorString.Substring(1), 16); color = new sColor(myXmlNode.Attributes["name"].Value, colorValue); } else { color = new sColor(myXmlNode.Attributes["name"].Value, colorString); } if (pColors[color.pName] == null) { pColors.Add(color.pName, color); } else { String errormessage = "More than one color defined with name " + color.pName; errormessage += "\n\n" + ((sColor)pColors[color.pName]).pName + "\t#" + Convert.ToString(((sColor)pColors[color.pName]).pValue, 16);; errormessage += "\n" + color.pName + "\t#" + Convert.ToString(color.pValue, 16); errormessage += "\n"; errormessage += "\n" + "The second definition will be deleted!"; MessageBox.Show(errormessage, "Error while parsing color table", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } string[] path2 = { "skin" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(null /*path2*/); checkColor(Node.ChildNodes); sync(XmlHandler); }
public void rename(cXMLHandler XmlHandler, String name, String to) { sColor color = (sColor)pColors[name]; remove(color); color.pName = to; add(color); string[] path = { /*"skin", */ "colors" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(path); renameColor(Node.ChildNodes, name, to); }
public override bool remove(Object element) { sColor color = (sColor)element; foreach (sColor tmpcolor in pColors.Values) { if (tmpcolor.pName == color.pName) { pColors.Remove(tmpcolor.pName); return(true); } } return(false); }
public override Object get(String name) { if (name == "(none)") { return(null); } if (name[0] == '#') { // if (MyGlobaleVariables.AddUndefinedColor == "#") if (Properties.Settings.Default.addUndefinedColor == true) // Add undifined color with '#' { try { uint colorValue = Convert.ToUInt32(name.Substring(1), 16); add(new sColor(name, colorValue)); return(new sColor(name, colorValue)); } catch (Exception) { MessageBox.Show(fMain.GetTranslation("An invalid colour was specified!")); } } else // Add undifined color with 'un' { try { uint colorValue = Convert.ToUInt32(name.Substring(1), 16); add(new sColor(name.Replace("#", "un"), colorValue)); return(new sColor(name.Replace("#", "un"), colorValue)); } catch (Exception) { MessageBox.Show(fMain.GetTranslation("An invalid colour was specified!")); } } // add(new sColor(name, Convert.ToUInt32(name.Substring(1), 16))); //MOD // return new sColor("undefined", Convert.ToUInt32(name.Substring(1), 16)); // Original // return new sColor(name, Convert.ToUInt32(name.Substring(1), 16)); //MOD } Object col = (Object)pColors[name]; if (col == null) { col = new sColor(name, 0xFF00FF); add(col); } return(col); }
public override String add(Object element) { sColor color = (sColor)element; foreach (sColor tmpcolor in pColors.Values) { if (tmpcolor.pName == color.pName) { tmpcolor.pValue = color.pValue; return(color.pName); } } pColors.Add(color.pName, color); return(color.pName); }
public override Object get(String name) { if (name == "(none)") { return(null); } if (name[0] == '#') { return(new sColor("undefined", Convert.ToUInt32(name.Substring(1), 16))); } Object col = (Object)pColors[name]; if (col == null) { col = new sColor(name, 0xFF00FF); add(col); } return(col); }
internal sMesh TosMesh(List <double> triVerticeInfo, sColor scol) { //nine conseq sMesh sm = new sMesh(); int faceCount = (int)(triVerticeInfo.Count / 9); int verID = 0; int infoID = 0; for (int i = 0; i < faceCount; ++i) { sm.SetVertex(verID + 0, new sXYZ(triVerticeInfo[infoID + 0], triVerticeInfo[infoID + 1], triVerticeInfo[infoID + 2]), scol); sm.SetVertex(verID + 1, new sXYZ(triVerticeInfo[infoID + 3], triVerticeInfo[infoID + 4], triVerticeInfo[infoID + 5]), scol); sm.SetVertex(verID + 2, new sXYZ(triVerticeInfo[infoID + 6], triVerticeInfo[infoID + 7], triVerticeInfo[infoID + 8]), scol); sm.SetFace(i, verID + 0, verID + 1, verID + 2); verID += 3; infoID += 9; } sm.ComputeNormals(); return(sm); }
public void removeColor(cXMLHandler XmlHandler, String name, String to) { sColor color = (sColor)pColors[name]; remove(color); }
public cDataBaseColor(cXMLHandler XmlHandler) { pColors = new Hashtable(); string[] path = { /*"skin", */ "colors" }; XmlNode colorNode = XmlHandler.XmlGetRootNodeElement(path); foreach (XmlNode myXmlNode in colorNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } String colorString = myXmlNode.Attributes["value"].Value; sColor color; if (colorString[0] == '#') { UInt32 colorValue = Convert.ToUInt32(colorString.Substring(1), 16); color = new sColor(myXmlNode.Attributes["name"].Value, colorValue); } else { color = new sColor(myXmlNode.Attributes["name"].Value, colorString); } if (pColors[color.pName] == null) { pColors.Add(color.pName, color); } else { String errormessage = fMain.GetTranslation("More than one color defined with name") + " '" + color.pName + "'"; errormessage += "\n\n" + ((sColor)pColors[color.pName]).pName + "\t#" + Convert.ToString(((sColor)pColors[color.pName]).pValue, 16);; errormessage += "\n" + color.pName + "\t#" + Convert.ToString(color.pValue, 16); errormessage += "\n"; errormessage += "\n" + fMain.GetTranslation("The second definition will be deleted if you save manually."); errormessage += "\n"; errormessage += "\n" + fMain.GetTranslation("Until you save, the second definition is still shown in TreeView!"); errormessage += "\n"; errormessage += "\n" + fMain.GetTranslation("Do you want to save and reload the skin?"); if (MessageBox.Show(errormessage, fMain.GetTranslation("Error while parsing color table"), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { MyGlobaleVariables.Reload = true; } } } string[] path2 = { "skin" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(null /*path2*/); checkColor(Node.ChildNodes); sync(XmlHandler); }
public sColor GetBeamResultColor(sRange dataRange, eColorMode colorMode, int resultIndex, int sectionIndex, int alpha, sRange threshold = null) { sColor col = new sColor(); sColorGradient cg = null; if (colorMode == eColorMode.Force_X) { double valThis = this.results[resultIndex].force.X; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Force_Y) { double valThis = this.results[resultIndex].force.Y; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Force_Z) { double valThis = this.results[resultIndex].force.Z; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Moment_X) { double valThis = this.results[resultIndex].moment.X; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Moment_Y) { double valThis = this.results[resultIndex].moment.Y; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Moment_Z) { double valThis = this.results[resultIndex].moment.Z; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Stress_Combined_Absolute) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].stress_Combined; cg = sColorGradient.GetRainbowLikeGradient(dataRange, threshold); double remapped = dataRange.GetNormalizedAt(valThis);//dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Stress_Axial_X) { } else if (colorMode == eColorMode.Stress_Moment_Y) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].stress_Moment_Y; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); //double remapped = dataRange.GetNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Stress_Moment_Z) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].stress_Moment_Z; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); //double remapped = dataRange.GetNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Deflection) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].deflection_mm.GetLength(); cg = sColorGradient.GetRainbowLikeGradient(dataRange, threshold); double remapped = dataRange.GetNormalizedAt(valThis);//dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.NONE) { col = new sColor(200, 200, 200); } return(col); }
public sMesh ConstructBeamColorMesh(sRange dataRange, eColorMode colorMode, sRange threshold, double du) { sMesh sm = new sMesh(); int vertexID = 0; for (int i = 0; i < this.results.Count; ++i) { sFrameResult br = this.results[i]; for (int j = 0; j < br.sectionResults.Count; ++j) { sFrameSectionResult sr = br.sectionResults[j]; sColor vcol = this.GetBeamResultColor(dataRange, colorMode, i, j, 255, threshold); sXYZ deflectionVec = du * (sr.deflection_mm * 0.001); sXYZ deflectedPt = sr.location + deflectionVec; sm.SetVertex(vertexID, deflectedPt, vcol); //or //sm.SetVertex(vertexID, sr.point, vcol); sr.ID = vertexID; vertexID++; } } int vertexCountPerFace = this.results[0].sectionResults.Count; int faceIndex = 0; for (int i = 0; i < this.results.Count - 1; ++i) { sFrameResult br_this = this.results[i]; sFrameResult br_next = this.results[i + 1]; for (int j = 0; j < br_this.sectionResults.Count; ++j) { int id0 = 0; int id1 = 0; int id2 = 0; int id3 = 0; if (j < br_this.sectionResults.Count - 1) { id0 = br_this.sectionResults[j].ID; id1 = br_next.sectionResults[j].ID; id2 = br_next.sectionResults[j + 1].ID; id3 = br_this.sectionResults[j + 1].ID; } else { id0 = br_this.sectionResults[j].ID; id1 = br_next.sectionResults[j].ID; id2 = br_next.sectionResults[0].ID; id3 = br_this.sectionResults[0].ID; } sm.SetFace(faceIndex, faceIndex + 1, id0, id1, id2, id3); faceIndex += 2; } } sm.ComputeNormals(); return(sm); }