Exemple #1
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "url")
            {
                URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "repeatS")
            {
                RepeatS = parser.ParseBoolValue();
            }
            else if (id == "repeatT")
            {
                RepeatT = parser.ParseBoolValue();
            }
            else if (id == "textureProperties")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TextureProperties = node as IX3DTexturePropertiesNode;
                    if (TextureProperties == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #2
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "geometry")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Geometry = node as X3DGeometryNode;
                    if (Geometry == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #3
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "collidables" || id == "collider")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Collider = node as IX3DCollisionCollectionNode;
                    if (Collider == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #4
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "controlPoint")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    ControlPoint = node as X3DCoordinateNode;
                    if (ControlPoint == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "knot")
            {
                Knot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "order")
            {
                Order = parser.ParseIntValue();
            }
            else if (id == "weight")
            {
                Weight.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "name")
            {
                Name = parser.ParseStringValue();
            }
            else if (id == "shape")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Shape = node as IX3DCADFaceShape;
                    if (Shape == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "center")
            {
                Center = parser.ParseSFVec3fValue();
            }
            else if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "size")
            {
                Size = parser.ParseSFVec3fValue();
            }
            else if (id == "targetObject")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TargetObject = node as IX3DTranformSensorTargetObject;
                    if (TargetObject == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
		internal void ErrorParsingNode(VRMLReaderError error, Exception reason, X3DNode node, string fieldName, X3DNode value, int line)
		{
			if(error==VRMLReaderError.UnexpectedNodeType)
			{
				if(errorHandling.UnexpectedNodeType!=ErrorWarnIgnore.Ignore)
				{
					string msg="Error parsing node: Unexpected type while parsing node: '"+node.GetNodeName()+"' field: '"+fieldName+"'";
					if(value!=null) msg+=" found: '"+value.GetNodeName()+"'";
					msg+=" in line: "+line;
					WriteWarning(msg);
				}
				if(errorHandling.UnexpectedNodeType!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.UnknownFieldInNode)
			{
				if(errorHandling.UnknownFieldInNode!=ErrorWarnIgnore.Ignore)
				{
					string msg="Error parsing node: Unknown field while parsing node: '"+node.GetNodeName()+"' field: '"+fieldName+"' in line: "+line;
					WriteWarning(msg);
				}
				if(errorHandling.UnknownFieldInNode!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.SFImageInvalid)
			{
				string msg="Error parsing node: Could not parse SFImage value while parsing node: '"+node.GetNodeName()+"' field: '"+fieldName+"' in line: "+line;
				WriteWarning(msg);
			}
			
			throw new VRMLReaderException(error, reason, line);
		}
Exemple #8
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "update")
            {
                Update = parser.ParseStringValue();
            }
            else if (id == "size")
            {
                Size = parser.ParseIntValue();
            }
            else if (id == "textureProperties")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TextureProperties = node as IX3DTexturePropertiesNode;
                    if (TextureProperties == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #9
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "direction")
            {
                Direction = parser.ParseSFVec3fValue();
            }
            else if (id == "intensity")
            {
                Intensity = parser.ParseDoubleValue();
            }
            else if (id == "location")
            {
                Location = parser.ParseSFVec3fValue();
            }
            else if (id == "maxBack")
            {
                MaxBack = parser.ParseDoubleValue();
            }
            else if (id == "maxFront")
            {
                MaxFront = parser.ParseDoubleValue();
            }
            else if (id == "minBack")
            {
                MinBack = parser.ParseDoubleValue();
            }
            else if (id == "minFront")
            {
                MinFront = parser.ParseDoubleValue();
            }
            else if (id == "priority")
            {
                Priority = parser.ParseDoubleValue();
            }
            else if (id == "source")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Source = node as X3DSoundSourceNode;
                    if (Source == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "spatialize")
            {
                Spatialize = parser.ParseBoolValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #10
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "coord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Coord = node as X3DCoordinateNode;
                    if (Coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "direction")
            {
                Direction = parser.ParseSFVec3fValue();
            }
            else if (id == "speed")
            {
                Speed = parser.ParseDoubleValue();
            }
            else if (id == "variation")
            {
                Variation = parser.ParseDoubleValue();
            }
            else if (id == "coordIndex")
            {
                if (wasCoordIndex)
                {
                    CoordIndex.AddRange(parser.ParseSFInt32OrMFInt32Value());
                }
                else
                {
                    CoordIndex = parser.ParseSFInt32OrMFInt32Value();
                }
                wasCoordIndex = true;
            }
            else if (id == "internal")
            {
                Internal = parser.ParseBoolValue();
            }
            else if (id == "mass")
            {
                Mass = parser.ParseDoubleValue();
            }
            else if (id == "surfaceArea")
            {
                SurfaceArea = parser.ParseDoubleValue();
            }
            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 X3DChildNode;
                    if (child == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Children.Add(child);
                    }
                }
            }
            else if (id == "layout")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Layout = node as X3DLayoutNode;
                    if (Layout == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "viewport")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Viewport = node as X3DViewportNode;
                    if (Viewport == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #12
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "controlPoint")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    ControlPoint = node as X3DCoordinateNode;
                    if (ControlPoint == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "knot")
            {
                Knot.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "order")
            {
                Order = parser.ParseIntValue();
            }
            else if (id == "weight" || id == "keyWeight")
            {
                Weight.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "dimension")
            {
                Dimension = parser.ParseIntValue();
            }
            else if (id == "fractionAbsolute")
            {
                FractionAbsolute = parser.ParseBoolValue();
            }
            else if (id == "keyValue")
            {
                List <SFVec3f> controlPoints = parser.ParseSFVec3fOrMFVec3fValue();
                if (ControlPoint == null)
                {
                    ControlPoint = new x3dCoordinate();
                }

                x3dCoordinate cp = ControlPoint as x3dCoordinate;
                if (cp != null)
                {
                    cp.Point.AddRange(controlPoints);
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #13
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 X3DChildNode;
                    if (child == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Children.Add(child);
                    }
                }
            }
            else if (id == "collide" || id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else if (id == "proxy")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Proxy = node as X3DChildNode;
                    if (Proxy == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #14
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "anchorPoint")
            {
                AnchorPoint = parser.ParseSFVec3fValue();
            }
            else if (id == "body1")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Body1 = node as IX3DRigidBodyNode;
                    if (Body1 == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "body2")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Body2 = node as IX3DRigidBodyNode;
                    if (Body2 == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "forceOutput" || id == "mustOutput")
            {
                if (wasForceOutput)
                {
                    ForceOutput.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    ForceOutput = parser.ParseSFStringOrMFStringValue();
                }
                wasForceOutput = true;
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #15
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "geoCenter")
            {
                GeoCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "size")
            {
                Size = parser.ParseSFVec3fValue();
            }
            else if (id == "geoOrigin")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    GeoOrigin = node as IX3DGeoOriginNode;
                    if (GeoOrigin == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "geoSystem")
            {
                if (wasGeoSystem)
                {
                    GeoSystem.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    GeoSystem = parser.ParseSFStringOrMFStringValue();
                }
                wasGeoSystem = true;
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "rotation")
            {
                Rotation = parser.ParseSFRotationValue();
            }
            else if (id == "translation")
            {
                Translation = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else if (id == "collidable")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Collidable = node as X3DNBodyCollidableNode;
                    if (Collidable == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #17
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "appearance")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Appearance = node as X3DAppearanceNode;
                    if (Appearance == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "geometry")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Geometry = node as X3DGeometryNode;
                    if (Geometry == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #18
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "crossSectionCurve")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    CrossSectionCurve = node as X3DNurbsControlCurveNode;
                    if (CrossSectionCurve == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "trajectoryCurve")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TrajectoryCurve = node as IX3DNurbsCurveNode;
                    if (TrajectoryCurve == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "ccw")
            {
                CCW = parser.ParseBoolValue();
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "fontStyle")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FontStyle = node as X3DFontStyleNode;
                    if (FontStyle == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "length")
            {
                Length.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "maxExtent")
            {
                MaxExtent = parser.ParseDoubleValue();
            }
            else if (id == "string")
            {
                String.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "center")
            {
                Center = parser.ParseSFVec3fStringValue();
            }
            else if (id == "child1Url")
            {
                Child1URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "child2Url")
            {
                Child2URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "child3Url")
            {
                Child3URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "child4Url")
            {
                Child4URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "geoOrigin")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    GeoOrigin = node as IX3DGeoOriginNode;
                    if (GeoOrigin == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "geoSystem")
            {
                if (wasGeoSystem)
                {
                    GeoSystem.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    GeoSystem = parser.ParseSFStringOrMFStringValue();
                }
                wasGeoSystem = true;
            }
            else if (id == "range")
            {
                Range = parser.ParseDoubleValue();
            }
            else if (id == "rootUrl")
            {
                RootURL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "rootNode")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DChildNode rn = node as X3DChildNode;
                    if (rn == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        RootNode.Add(rn);
                    }
                }
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "axis1Angle")
            {
                Axis1Angle = parser.ParseDoubleValue();
            }
            else if (id == "axis1Torque")
            {
                Axis1Torque = parser.ParseDoubleValue();
            }
            else if (id == "axis2Angle")
            {
                Axis2Angle = parser.ParseDoubleValue();
            }
            else if (id == "axis2Torque")
            {
                Axis2Torque = parser.ParseDoubleValue();
            }
            else if (id == "axis3Angle")
            {
                Axis3Angle = parser.ParseDoubleValue();
            }
            else if (id == "axis3Torque")
            {
                Axis3Torque = parser.ParseDoubleValue();
            }
            else if (id == "body1")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Body1 = node as IX3DRigidBodyNode;
                    if (Body1 == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "body2")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Body2 = node as IX3DRigidBodyNode;
                    if (Body2 == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "enabledAxes")
            {
                EnabledAxes = parser.ParseIntValue();
            }
            else if (id == "forceOutput")
            {
                if (wasForceOutput)
                {
                    ForceOutput.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    ForceOutput = parser.ParseSFStringOrMFStringValue();
                }
                wasForceOutput = true;
            }
            else if (id == "motor1Axis")
            {
                Motor1Axis = parser.ParseSFVec3fValue();
            }
            else if (id == "motor2Axis")
            {
                Motor2Axis = parser.ParseSFVec3fValue();
            }
            else if (id == "motor3Axis")
            {
                Motor3Axis = parser.ParseSFVec3fValue();
            }
            else if (id == "stop1Bounce")
            {
                Stop1Bounce = parser.ParseDoubleValue();
            }
            else if (id == "stop1ErrorCorrection")
            {
                Stop1ErrorCorrection = parser.ParseDoubleValue();
            }
            else if (id == "stop2Bounce")
            {
                Stop2Bounce = parser.ParseDoubleValue();
            }
            else if (id == "stop2ErrorCorrection")
            {
                Stop2ErrorCorrection = parser.ParseDoubleValue();
            }
            else if (id == "stop3Bounce")
            {
                Stop3Bounce = parser.ParseDoubleValue();
            }
            else if (id == "stop3ErrorCorrection")
            {
                Stop3ErrorCorrection = parser.ParseDoubleValue();
            }
            else if (id == "autoCalc")
            {
                AutoCalc = parser.ParseBoolValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "centerOfMass")
            {
                CenterOfMass = parser.ParseSFVec3fValue();
            }
            else if (id == "children")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DChildNode child = node as X3DChildNode;
                    if (child == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Children.Add(child);
                    }
                }
            }
            else if (id == "coord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Coord = node as X3DCoordinateNode;
                    if (Coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "displacers")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    IX3DHAnimDisplacerNode displacer = node as IX3DHAnimDisplacerNode;
                    if (displacer == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Displacers.Add(displacer);
                    }
                }
            }
            else if (id == "mass")
            {
                Mass = parser.ParseDoubleValue();
            }
            else if (id == "momentsOfInertia")
            {
                if (wasMomentsOfInertia)
                {
                    MomentsOfInertia.AddRange(parser.ParseSFFloatOrMFFloatValue());
                }
                else
                {
                    MomentsOfInertia = parser.ParseSFFloatOrMFFloatValue();
                }
                wasMomentsOfInertia = true;
            }
            else if (id == "name")
            {
                Name = parser.ParseStringValue();
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "back")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Back = node as X3DTexture2DNode;
                    if (Back == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "bottom")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Bottom = node as X3DTexture2DNode;
                    if (Bottom == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "front")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Front = node as X3DTexture2DNode;
                    if (Front == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "left")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Left = node as X3DTexture2DNode;
                    if (Left == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "right")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Right = node as X3DTexture2DNode;
                    if (Right == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "top")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Top = node as X3DTexture2DNode;
                    if (Top == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
		void ParseScriptBodyElement(X3DNode node, string id)
		{
			// nodeBodyElement | interfaceDeclaration |
			// inputOnly fieldType inputOnlyId IS inputOnlyId |
			// outputOnly fieldType outputOnlyId IS outputOnlyId |
			// initializeOnly fieldType initializeOnlyId IS initializeOnlyId |
			// inputOutput fieldType inputOutputId IS inputOutputId

			IScriptNode script=node as IScriptNode;

			switch(id)
			{
				case "eventIn":
				case "inputOnly":
				case "eventOut":
				case "outputOnly":
					{
						string tokenEvent=GetNextIDToken();
						FieldType fieldType=GetNextFieldTypeToken();
						string eventId=GetNextIDToken();

						InterfaceDeclaration fieldDeclaration=new InterfaceDeclaration();
						fieldDeclaration.FieldId=eventId;
						fieldDeclaration.FieldType=fieldType;
						if(id=="eventIn"||id=="inputOnly")
							fieldDeclaration.InterfaceDeclarationType=InterfaceDeclarationType.EventIn;
						else fieldDeclaration.InterfaceDeclarationType=InterfaceDeclarationType.EventOut;

						if(inPROTO)
						{
							// Check if id is followed by IS Keyword
							object token=PeekNextToken();
							VRMLTokenIdKeywordOrFieldType idToken=token as VRMLTokenIdKeywordOrFieldType;
							if(idToken!=null&&idToken.id=="IS")
							{
								string tokenIS=GetNextIDToken();
								string isID=GetNextIDToken();

								if(node.Substitutions.ContainsKey(eventId))
								{
									if(node.Substitutions[eventId]==isID) ErrorParsing(VRMLReaderError.RedundantISStatement);
									else ErrorParsing(VRMLReaderError.MultipleISStatementForField);
								}
								else node.Substitutions.Add(eventId, isID);
							}
						}

						script.ScriptingInterfaceDeclarations.Add(fieldDeclaration);
					}
					break;
				case "field":
				case "initializeOnly":
				case "exposedField":
				case "inputOutput":
					{
						string tokenEvent=GetNextIDToken();
						FieldType fieldType=GetNextFieldTypeToken();
						string fieldId=GetNextIDToken();

						InterfaceDeclaration fieldDeclaration=new InterfaceDeclaration();
						fieldDeclaration.FieldId=fieldId;
						fieldDeclaration.FieldType=fieldType;
						if(id=="field"||id=="initializeOnly")
							fieldDeclaration.InterfaceDeclarationType=InterfaceDeclarationType.Field;
						else fieldDeclaration.InterfaceDeclarationType=InterfaceDeclarationType.ExposedField;

						// Check if id is followed by IS Keyword
						object token=PeekNextToken();
						VRMLTokenIdKeywordOrFieldType idToken=token as VRMLTokenIdKeywordOrFieldType;
						if(inPROTO&&idToken!=null&&idToken.id=="IS")
						{
							string tokenIS=GetNextIDToken();
							string isID=GetNextIDToken();

							if(node.Substitutions.ContainsKey(fieldId))
							{
								if(node.Substitutions[fieldId]==isID) ErrorParsing(VRMLReaderError.RedundantISStatement);
								else ErrorParsing(VRMLReaderError.MultipleISStatementForField);
							}
							else node.Substitutions.Add(fieldId, isID);
						}
						else fieldDeclaration.DefaultValue=ParseFieldByType(fieldType);

						script.ScriptingInterfaceDeclarations.Add(fieldDeclaration);
					}
					break;
				default: ParseNodeBodyElement(node, id); break;
			}
		}
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "attrib")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DVertexAttributeNode attr = node as X3DVertexAttributeNode;
                    if (attr == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Attrib.Add(attr);
                    }
                }
            }
            else if (id == "color")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Color = node as X3DColorNode;
                    if (Color == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "fogCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FogCoord = node as IX3DFogCoordinateNode;
                    if (FogCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "normal")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Normal = node as X3DNormalNode;
                    if (Normal == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "texCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TexCoord = node as X3DTextureCoordinateNode;
                    if (TexCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "ccw")
            {
                CCW = parser.ParseBoolValue();
            }
            else if (id == "colorPerVertex")
            {
                ColorPerVertex = parser.ParseBoolValue();
            }
            else if (id == "creaseAngle")
            {
                CreaseAngle = parser.ParseDoubleValue();
            }
            else if (id == "height")
            {
                Height.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "normalPerVertex")
            {
                NormalPerVertex = parser.ParseBoolValue();
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else if (id == "xDimension")
            {
                XDimension = parser.ParseIntValue();
            }
            else if (id == "xSpacing")
            {
                XSpacing = parser.ParseDoubleValue();
            }
            else if (id == "zDimension")
            {
                ZDimension = parser.ParseIntValue();
            }
            else if (id == "zSpacing")
            {
                ZSpacing = parser.ParseDoubleValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #26
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "attrib")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DVertexAttributeNode attr = node as X3DVertexAttributeNode;
                    if (attr == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Attrib.Add(attr);
                    }
                }
            }
            else if (id == "color")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Color = node as X3DColorNode;
                    if (Color == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "coord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Coord = node as X3DCoordinateNode;
                    if (Coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "fogCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FogCoord = node as IX3DFogCoordinateNode;
                    if (FogCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "normal")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Normal = node as X3DNormalNode;
                    if (Normal == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "texCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TexCoord = node as X3DTextureCoordinateNode;
                    if (TexCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "ccw")
            {
                CCW = parser.ParseBoolValue();
            }
            else if (id == "colorPerVertex")
            {
                ColorPerVertex = parser.ParseBoolValue();
            }
            else if (id == "normalPerVertex")
            {
                NormalPerVertex = parser.ParseBoolValue();
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else if (id == "index")
            {
                Index = parser.ParseSFInt32OrMFInt32Value();
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "description")
            {
                Description = parser.ParseStringValue();
            }
            else if (id == "loop")
            {
                Loop = parser.ParseBoolValue();
            }
            else if (id == "pauseTime")
            {
                PauseTime = parser.ParseDoubleValue();
            }
            else if (id == "resumeTime")
            {
                ResumeTime = parser.ParseDoubleValue();
            }
            else if (id == "speed" || id == "pitch")
            {
                Pitch = parser.ParseDoubleValue();
            }
            else if (id == "startTime")
            {
                StartTime = parser.ParseDoubleValue();
            }
            else if (id == "stopTime")
            {
                StopTime = parser.ParseDoubleValue();
            }
            else if (id == "url")
            {
                URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "repeatS")
            {
                RepeatS = parser.ParseBoolValue();
            }
            else if (id == "repeatT")
            {
                RepeatT = parser.ParseBoolValue();
            }
            else if (id == "textureProperties")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TextureProperties = node as IX3DTexturePropertiesNode;
                    if (TextureProperties == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #28
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "objectType")
            {
                if (wasObjectType)
                {
                    ObjectType.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    ObjectType = parser.ParseSFStringOrMFStringValue();
                }
                wasObjectType = true;
            }
            else if (id == "pickingGeometry")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    PickingGeometry = node as IX3DPointPickSensorPickingGeometry;
                    if (PickingGeometry == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "pickTarget")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    IX3DPickSensorNodePickTarget pt = node as IX3DPickSensorNodePickTarget;
                    if (pt == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        PickTarget.Add(pt);
                    }
                }
            }
            else if (id == "intersectionType")
            {
                IntersectionType = parser.ParseStringValue();
            }
            else if (id == "sortOrder")
            {
                SortOrder = parser.ParseStringValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #29
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "fillProperties")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FillProperties = node as IX3DFillPropertiesNode;
                    if (FillProperties == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "lineProperties")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    LineProperties = node as IX3DLinePropertiesNode;
                    if (LineProperties == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "material")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Material = node as X3DMaterialNode;
                    if (Material == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "shaders")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DShaderNode sn = node as X3DShaderNode;
                    if (sn == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Shaders.Add(sn);
                    }
                }
            }
            else if (id == "texture")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Texture = node as X3DTextureNode;
                    if (Texture == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "textureTransform")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TextureTransform = node as X3DTextureTransformNode;
                    if (TextureTransform == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #30
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "image")
            {
                try
                {
                    Image.Clear();
                    Image.Add(parser.ParseIntValue());                     // Number of Components
                    Image.Add(parser.ParseIntValue());                     // Width
                    Image.Add(parser.ParseIntValue());                     // Height
                    Image.Add(parser.ParseIntValue());                     // Depth
                }
                catch (UserCancellationException) { throw; }
                catch (Exception ex)
                {
                    parser.ErrorParsingNode(VRMLReaderError.SFImageInvalid, ex, this, id, null, line);
                }

                if (Image[1] < 0 || Image[2] < 0 || Image[3] < 0 || Image[0] < 0 || Image[0] > 4)
                {
                    parser.ErrorParsingNode(VRMLReaderError.SFImageInvalid, this, id, null, line);
                }

                if (!(Image[0] == 0 || Image[1] == 0 || Image[2] == 0 || Image[3] == 0))
                {
                    int count = Image[1] * Image[2] * Image[3];
                    try
                    {
                        for (int i = 0; i < count; i++)
                        {
                            Image.Add(parser.ParseIntValue());
                        }
                    }
                    catch (UserCancellationException) { throw; }
                    catch (Exception ex)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.SFImageInvalid, ex, this, id, null, parser.Line);
                    }
                }
            }
            else if (id == "repeatS")
            {
                RepeatS = parser.ParseBoolValue();
            }
            else if (id == "repeatR")
            {
                RepeatR = parser.ParseBoolValue();
            }
            else if (id == "repeatT")
            {
                RepeatT = parser.ParseBoolValue();
            }
            else if (id == "textureProperties")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TextureProperties = node as IX3DTexturePropertiesNode;
                    if (TextureProperties == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "attrib")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DVertexAttributeNode attr = node as X3DVertexAttributeNode;
                    if (attr == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Attrib.Add(attr);
                    }
                }
            }
            else if (id == "color")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Color = node as X3DColorNode;
                    if (Color == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "coord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Coord = node as X3DCoordinateNode;
                    if (Coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "fogCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FogCoord = node as IX3DFogCoordinateNode;
                    if (FogCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
		void ParseScriptBody(X3DNode node)
		{
			// scriptBodyElement | scriptBodyElement scriptBody | empty

			for(; ; )
			{
				object token=PeekNextToken();

				VRMLTokenTerminalSymbol tsToken=token as VRMLTokenTerminalSymbol;
				if(tsToken!=null&&tsToken.symbol=='}') return; // done

				VRMLTokenIdKeywordOrFieldType idToken=token as VRMLTokenIdKeywordOrFieldType;
				if(idToken==null) ErrorParsingToken("statement keyword or field id", "", "script node body");

				ParseScriptBodyElement(node, idToken.id);
			}
		}
Exemple #33
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "axis")
            {
                Axis = parser.ParseSFVec3fValue();
            }
            else if (id == "body1")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Body1 = node as IX3DRigidBodyNode;
                    if (Body1 == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "body2")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Body2 = node as IX3DRigidBodyNode;
                    if (Body2 == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "forceOutput" || id == "mustOutput")
            {
                if (wasForceOutput)
                {
                    ForceOutput.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    ForceOutput = parser.ParseSFStringOrMFStringValue();
                }
                wasForceOutput = true;
            }
            else if (id == "maxSeparation")
            {
                MaxSeparation = parser.ParseDoubleValue();
            }
            else if (id == "minSeparation")
            {
                MinSeparation = parser.ParseDoubleValue();
            }
            else if (id == "sliderForce")
            {
                SliderForce = parser.ParseDoubleValue();
            }
            else if (id == "stopBounce")
            {
                StopBounce = parser.ParseDoubleValue();
            }
            else if (id == "stopErrorCorrection")
            {
                StopErrorCorrection = parser.ParseDoubleValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
		void ParseNodeBodyElement(X3DNode node, string id)
		{
			// initializeOnlyId fieldValue |
			// initializeOnlyId IS initializeOnlyId |
			// inputOnlyId IS inputOnlyId |
			// outputOnlyId IS outputOnlyId |
			// inputOutputId IS inputOutputId |
			// routeStatement | protoStatement

			switch(id)
			{
				case "PROTO":
				case "EXTERNPROTO":
					{
						string nodeTypeId;
						X3DPrototypeInstance proto=ParseProtoStatement(out nodeTypeId);
						protoDefinitions.Add(nodeTypeId, proto);
					}
					break;
				case "ROUTE": ParseRouteStatement(); break;
				default:
					{
						GetNextIDToken(); // id

						object token=PeekNextToken();
						VRMLTokenIdKeywordOrFieldType idToken=token as VRMLTokenIdKeywordOrFieldType;
						if(inPROTO&&(idToken!=null&&idToken.id=="IS"))
						{
							string tokenIS=GetNextIDToken();
							string isID=GetNextIDToken();

							if(node.Substitutions.ContainsKey(id))
							{
								if(node.Substitutions[id]==isID) ErrorParsing(VRMLReaderError.RedundantISStatement);
								else ErrorParsing(VRMLReaderError.MultipleISStatementForField);
							}
							else node.Substitutions.Add(id, isID);
						}
						else
						{
							if(id=="metadata")
							{
								X3DNode mdnode=ParseSFNodeValue();
								if(mdnode!=null)
								{
									node.Metadata=mdnode as X3DMetadataObject;
									if(node.Metadata==null) ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, node, id, mdnode, line);
								}
							}
							else
							{
								X3DPrototypeInstance proto=node as X3DPrototypeInstance;
								if(proto!=null)
								{
									InterfaceDeclaration decl=null;
									for(int i=0; i<proto.InterfaceDeclarations.Count; i++)
									{
										if(id==proto.InterfaceDeclarations[i].FieldId)
										{
											decl=proto.InterfaceDeclarations[i];
											break;
										}
									}

									if(decl!=null)
									{
										if(decl.InterfaceDeclarationType==InterfaceDeclarationType.EventIn||
											decl.InterfaceDeclarationType==InterfaceDeclarationType.EventOut)
											ErrorParsingNode(VRMLReaderError.UnknownFieldInNode, node, id, null, line);

										X3DFieldBase field=ParseFieldByType(decl.FieldType);
										if(field!=null) node.Fields[id]=field;
									}
									else
									{
										ErrorParsingNode(VRMLReaderError.UnknownFieldInNode, node, id, null, line);

										X3DFieldBase field=ParseUntypedFieldValue();
										if(field!=null) node.Fields[id]=field;
									}
								}
								else if(!node.ParseNodeBodyElement(id, this))
								{
									ErrorParsingNode(VRMLReaderError.UnknownFieldInNode, node, id, null, line);

									X3DFieldBase field=ParseUntypedFieldValue();
									if(field!=null) node.Fields[id]=field;
								}
							}
						}
					}
					break;
			}
		}
		internal void ErrorParsingNode(VRMLReaderError error, X3DNode node, string fieldName, X3DNode value, int line)
		{
			ErrorParsingNode(error, null, node, fieldName, value, line);
		}