Beispiel #1
0
        private static Stream CreateMoldDataStream(double width, double height, float variationIn3DCoordinates, int ptDensity, Logger logger)
        {
            float xAndZVariation;
            float yVariation;

            if (width > height)
            {
                xAndZVariation = variationIn3DCoordinates;
                yVariation     = ((float)height) * variationIn3DCoordinates / ((float)(width));
            }
            else if (height > width)
            {
                yVariation     = variationIn3DCoordinates;
                xAndZVariation = ((float)width) * variationIn3DCoordinates / ((float)(height));
            }
            else
            {
                xAndZVariation = yVariation = variationIn3DCoordinates;
            }

            var moldData = MoldFileCreator.CreateNewMoldFile(ptDensity, xAndZVariation, yVariation, xAndZVariation);

            logger.Log("Mold created.");
            return(moldData);
        }
Beispiel #2
0
        public static void CreateNewMold(string strMoldFilePath, XmlNode objMoldNode, string strPointDensityAttribute, bool blnPtDensityRequired)
        {
            //Check if point density has been supplied
            var strPtDensity = CommonFunctions.GetAttributeValue(objMoldNode, strPointDensityAttribute, blnPtDensityRequired);

            if (!string.IsNullOrEmpty(strPtDensity))
            {
                uint uintPtDensity;
                if (!UInt32.TryParse(strPtDensity, out uintPtDensity))
                {
                    throw new Exception("An invalid value exists for the PointDensity attribute. An unsigned int value was expected.");
                }
                if (uintPtDensity < 3)
                {
                    throw new Exception("The PointDensity should have a value greater than 2");
                }
                MoldFileCreator.CreateNewMoldFile(strMoldFilePath, uintPtDensity);
            }
            else
            {
                MoldFileCreator.CreateNewMoldFile(strMoldFilePath);
            }
        }