Beispiel #1
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            if (id == "key")
            {
                Key.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "keyValue")
            {
                object token = parser.PeekNextToken();
                if (token is VRMLTokenString)
                {
                    string   values = parser.ParseStringValue();
                    string[] parts  = values.Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string part in parts)
                    {
                        string l = part.ToLower();
                        if (l == "true")
                        {
                            KeyValue.Add(new SFBool(true));
                        }
                        else
                        {
                            KeyValue.Add(new SFBool(false));
                        }
                    }
                }
                else
                {
                    List <bool> values = parser.ParseSFBoolOrMFBoolValue();
                    foreach (bool value in values)
                    {
                        KeyValue.Add(new SFBool(value));
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "children")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DChildNode child = node as X3DShapeNode;
                    if (child == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Children.Add(child);
                    }
                }
            }
            else if (id == "controlPoint")
            {
                object token = parser.PeekNextToken();
                if (token is VRMLTokenIdKeywordOrFieldType)
                {
                    X3DNode node = parser.ParseSFNodeValue();
                    if (node != null)
                    {
                        ControlPoint = node as X3DCoordinateNode;
                        if (ControlPoint == null)
                        {
                            parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                        }
                    }
                }
                else
                {
                    x3dCoordinate coords = new x3dCoordinate();
                    coords.Point = parser.ParseSFVec3fOrMFVec3fValue();
                    ControlPoint = coords;
                }
            }
            else if (id == "inputCoord")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DCoordinateNode coord = node as X3DCoordinateNode;
                    if (coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        InputCoord.Add(coord);
                    }
                }
            }
            else if (id == "inputTransform")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    IX3DCoordinateDeformerInputTransform transf = node as IX3DCoordinateDeformerInputTransform;
                    if (transf == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        InputTransform.Add(transf);
                    }
                }
            }
            else if (id == "outputCoord")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DCoordinateNode coord = node as X3DCoordinateNode;
                    if (coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        OutputCoord.Add(coord);
                    }
                }
            }
            else if (id == "weight")
            {
                Weight.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else if (id == "uDimension")
            {
                UDimension = parser.ParseIntValue();
            }
            else if (id == "uKnot")
            {
                UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "uOrder")
            {
                UOrder = parser.ParseIntValue();
            }
            else if (id == "vDimension")
            {
                VDimension = parser.ParseIntValue();
            }
            else if (id == "vKnot")
            {
                VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "vOrder")
            {
                VOrder = parser.ParseIntValue();
            }
            else if (id == "wDimension")
            {
                WDimension = parser.ParseIntValue();
            }
            else if (id == "wKnot")
            {
                WKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "wOrder")
            {
                WOrder = parser.ParseIntValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
		internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
		{
			int line=parser.Line;

			if(id=="children")
			{
				List<X3DNode> nodes=parser.ParseSFNodeOrMFNodeValue();
				foreach(X3DNode node in nodes)
				{
					X3DChildNode child=node as X3DShapeNode;
					if(child==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
					else Children.Add(child);
				}
			}
			else if(id=="controlPoint")
			{
				object token=parser.PeekNextToken();
				if(token is VRMLTokenIdKeywordOrFieldType)
				{
					X3DNode node=parser.ParseSFNodeValue();
					if(node!=null)
					{
						ControlPoint=node as X3DCoordinateNode;
						if(ControlPoint==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
					}
				}
				else
				{
					x3dCoordinate coords=new x3dCoordinate();
					coords.Point=parser.ParseSFVec3fOrMFVec3fValue();
					ControlPoint=coords;
				}
			}
			else if(id=="inputCoord")
			{
				List<X3DNode> nodes=parser.ParseSFNodeOrMFNodeValue();
				foreach(X3DNode node in nodes)
				{
					X3DCoordinateNode coord=node as X3DCoordinateNode;
					if(coord==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
					else InputCoord.Add(coord);
				}
			}
			else if(id=="inputTransform")
			{
				List<X3DNode> nodes=parser.ParseSFNodeOrMFNodeValue();
				foreach(X3DNode node in nodes)
				{
					IX3DCoordinateDeformerInputTransform transf=node as IX3DCoordinateDeformerInputTransform;
					if(transf==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
					else InputTransform.Add(transf);
				}
			}
			else if(id=="outputCoord")
			{
				List<X3DNode> nodes=parser.ParseSFNodeOrMFNodeValue();
				foreach(X3DNode node in nodes)
				{
					X3DCoordinateNode coord=node as X3DCoordinateNode;
					if(coord==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
					else OutputCoord.Add(coord);
				}
			}
			else if(id=="weight") Weight.AddRange(parser.ParseSFFloatOrMFFloatValue());
			else if(id=="bboxCenter") BBoxCenter=parser.ParseSFVec3fValue();
			else if(id=="bboxSize") BBoxSize=parser.ParseSFVec3fValue();
			else if(id=="uDimension") UDimension=parser.ParseIntValue();
			else if(id=="uKnot") UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
			else if(id=="uOrder") UOrder=parser.ParseIntValue();
			else if(id=="vDimension") VDimension=parser.ParseIntValue();
			else if(id=="vKnot") VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
			else if(id=="vOrder") VOrder=parser.ParseIntValue();
			else if(id=="wDimension") WDimension=parser.ParseIntValue();
			else if(id=="wKnot") WKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
			else if(id=="wOrder") WOrder=parser.ParseIntValue();
			else return false;
			return true;
		}
Beispiel #4
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "controlPoint")
            {
                object token = parser.PeekNextToken();
                if (token is VRMLTokenIdKeywordOrFieldType)
                {
                    X3DNode node = parser.ParseSFNodeValue();
                    if (node != null)
                    {
                        ControlPoint = node as X3DCoordinateNode;
                        if (ControlPoint == null)
                        {
                            parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                        }
                    }
                }
                else
                {
                    x3dCoordinate coords = new x3dCoordinate();
                    coords.Point = parser.ParseSFVec3fOrMFVec3fValue();
                    ControlPoint = coords;
                }
            }
            else if (id == "texCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TexCoord = node as IX3DNurbsSurfaceGeometryNodeTexCoord;
                    if (TexCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "uTessellation")
            {
                UTessellation = parser.ParseIntValue();
            }
            else if (id == "vTessellation")
            {
                VTessellation = parser.ParseIntValue();
            }
            else if (id == "weight")
            {
                Weight.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "ccw")
            {
                CCW = parser.ParseBoolValue();
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else if (id == "uClosed")
            {
                UClosed = parser.ParseBoolValue();
            }
            else if (id == "uDimension")
            {
                UDimension = parser.ParseIntValue();
            }
            else if (id == "uKnot")
            {
                UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "uOrder")
            {
                UOrder = parser.ParseIntValue();
            }
            else if (id == "vClosed")
            {
                VClosed = parser.ParseBoolValue();
            }
            else if (id == "vDimension")
            {
                VDimension = parser.ParseIntValue();
            }
            else if (id == "vKnot")
            {
                VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "vOrder")
            {
                VOrder = parser.ParseIntValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }