BOOL EllipseRecordHandler::ReadEllipseSimple(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pEllipse; DocCoord CentrePoint; INT32 Height; INT32 Width; pEllipse = new NodeRegularShape; if (ok) ok = SetupShape(pEllipse); if (ok) ok = SetIsCircular(pEllipse, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoord(&CentrePoint); if (ok) ok = SetCentrePoint(pEllipse, CentrePoint); if (ok) ok = pCXaraFileRecord->ReadINT32(&Width); if (ok) ok = pCXaraFileRecord->ReadINT32(&Height); if (ok) ok = SetHeightAndWidth(pEllipse, Height, Width); if (ok) ok = InvalidateCache(pEllipse); if (ok) ok = InsertNode(pEllipse); return ok; }
BOOL EllipseRecordHandler::ReadEllipseComplex(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape *pEllipse; DocCoord CentrePoint; DocCoord MajorAxis; DocCoord MinorAxis; pEllipse = new NodeRegularShape; if (ok) ok = SetupShape(pEllipse); if (ok) ok = SetIsCircular(pEllipse, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoord(&CentrePoint); if (ok) ok = SetCentrePoint(pEllipse, CentrePoint); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); if (ok) ok = SetMajorAxis(pEllipse, MajorAxis); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); if (ok) ok = SetMinorAxis(pEllipse, MinorAxis); if (ok) ok = InvalidateCache(pEllipse); if (ok) ok = InsertNode(pEllipse); return ok; }
BOOL RectangleRecordHandler::ReadRectangleComplexRoundedReformed(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pRectangle; DocCoord MajorAxis; DocCoord MinorAxis; Matrix TransformMatrix; double Curvature; pRectangle = new NodeRegularShape; if (ok) ok = SetupShape(pRectangle); if (ok) ok = SetNumberOfSides(pRectangle, NumberOfSides); if (ok) ok = SetIsRounded(pRectangle, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); if (ok) ok = SetMajorAxis(pRectangle, MajorAxis); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); if (ok) ok = SetMinorAxis(pRectangle, MinorAxis); if (ok) ok = pCXaraFileRecord->ReadMatrix(&TransformMatrix); if (ok) ok = SetTransformMatrix(pRectangle, TransformMatrix); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&Curvature); if (ok) ok = SetCurvature(pRectangle, Curvature); if (ok) ok = pCXaraFileRecord->ReadPath(&(pRectangle->EdgePath1)); if (ok) ok = InvalidateCache(pRectangle); if (ok) ok = InsertNode(pRectangle); return ok; }
BOOL RectangleRecordHandler::ReadRectangleSimpleRoundedReformed(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pRectangle; DocCoord CentrePoint; INT32 Height; INT32 Width; double Curvature; pRectangle = new NodeRegularShape; if (ok) ok = SetupShape(pRectangle); if (ok) ok = SetNumberOfSides(pRectangle, NumberOfSides); if (ok) ok = SetIsRounded(pRectangle, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoord(&CentrePoint); if (ok) ok = SetCentrePoint(pRectangle, CentrePoint); if (ok) ok = pCXaraFileRecord->ReadINT32(&Width); if (ok) ok = pCXaraFileRecord->ReadINT32(&Height); if (ok) ok = SetHeightAndWidth(pRectangle, Height, Width); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&Curvature); if (ok) ok = SetCurvature(pRectangle, Curvature); if (ok) ok = pCXaraFileRecord->ReadPath(&(pRectangle->EdgePath1)); if (ok) ok = InvalidateCache(pRectangle); if (ok) ok = InsertNode(pRectangle); return ok; }
BOOL RectangleRecordHandler::ReadRectangleComplexRounded(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pRectangle; DocCoord CentrePoint; DocCoord MajorAxis; DocCoord MinorAxis; double Curvature; pRectangle = new NodeRegularShape; if (ok) ok = SetupShape(pRectangle); if (ok) ok = SetNumberOfSides(pRectangle, NumberOfSides); if (ok) ok = SetIsRounded(pRectangle, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoord(&CentrePoint); if (ok) ok = SetCentrePoint(pRectangle, CentrePoint); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); if (ok) ok = SetMajorAxis(pRectangle, MajorAxis); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); if (ok) ok = SetMinorAxis(pRectangle, MinorAxis); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&Curvature); if (ok) ok = SetCurvature(pRectangle, Curvature); if (ok) ok = InvalidateCache(pRectangle); if (ok) ok = InsertNode(pRectangle); return ok; }
BOOL RectangleRecordHandler::ReadRectangleSimple(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pRectangle; DocCoord CentrePoint; INT32 Height; INT32 Width; pRectangle = new NodeRegularShape; if (ok) ok = SetupShape(pRectangle); if (ok) ok = SetNumberOfSides(pRectangle, NumberOfSides); if (ok) ok = pCXaraFileRecord->ReadCoord(&CentrePoint); if (ok) ok = SetCentrePoint(pRectangle, CentrePoint); if (ok) ok = pCXaraFileRecord->ReadINT32(&Width); if (ok) ok = pCXaraFileRecord->ReadINT32(&Height); if (ok) ok = SetHeightAndWidth(pRectangle, Height, Width); if (ok) ok = InvalidateCache(pRectangle); if (ok) ok = InsertNode(pRectangle); return ok; }
BOOL RectangleRecordHandler::ReadRectangleSimpleStellated(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pRectangle; DocCoord CentrePoint; INT32 Height; INT32 Width; double StellationRadius; double StellationOffset; pRectangle = new NodeRegularShape; if (ok) ok = SetupShape(pRectangle); if (ok) ok = SetNumberOfSides(pRectangle, NumberOfSides); if (ok) ok = SetIsStellated(pRectangle, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoord(&CentrePoint); if (ok) ok = SetCentrePoint(pRectangle, CentrePoint); if (ok) ok = pCXaraFileRecord->ReadINT32(&Width); if (ok) ok = pCXaraFileRecord->ReadINT32(&Height); if (ok) ok = SetHeightAndWidth(pRectangle, Height, Width); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationRadius); if (ok) ok = SetStellationRadius(pRectangle, StellationRadius); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationOffset); if (ok) ok = SetStellationOffset(pRectangle, StellationOffset); if (ok) ok = InvalidateCache(pRectangle); if (ok) ok = InsertNode(pRectangle); return ok; }
void sphere::SetSphere(point c, float r, int res) { center = c; radius = r; resolution = res; SetupShape(); }
BOOL RegularShapeRecordHandler::ReadShapeGeneralPhase1(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pShape; BYTE Flags; UINT16 NumberOfSides; DocCoord UTCentrePoint; DocCoord MajorAxis; DocCoord MinorAxis; Matrix TransformMatrix; double StellationRadius; double StellationOffset; double PrimaryCurvature; double SecondaryCurvature; pShape = new NodeRegularShape; if (ok) ok = SetupShape(pShape); if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags); if (ok) ok = SetFlags(pShape, Flags); if (ok) ok = pCXaraFileRecord->ReadUINT16(&NumberOfSides); if (ok) ok = SetNumberOfSides(pShape, NumberOfSides); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&UTCentrePoint,0,0); if (ok) ok = SetUTCentrePoint(pShape, UTCentrePoint); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); if (ok) ok = SetMajorAxis(pShape, MajorAxis); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); if (ok) ok = SetMinorAxis(pShape, MinorAxis); if (ok) ok = pCXaraFileRecord->ReadMatrix(&TransformMatrix); if (ok) ok = SetTransformMatrix(pShape, TransformMatrix); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationRadius); if (ok) ok = SetStellationRadius(pShape, StellationRadius); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationOffset); if (ok) ok = SetStellationOffset(pShape, StellationOffset); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&PrimaryCurvature); if (ok) ok = SetPrimaryCurvature(pShape, PrimaryCurvature); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&SecondaryCurvature); if (ok) ok = SetSecondaryCurvature(pShape, SecondaryCurvature); if (ok) ok = pCXaraFileRecord->ReadPath(&(pShape->EdgePath1)); if (ok) ok = pCXaraFileRecord->ReadPath(&(pShape->EdgePath2)); if (ok) ok = InvalidateCache(pShape); if (ok) ok = InsertNode(pShape); return ok; }
void cone::SetCone(point c, float r, float h, int res, int a, bool capped) { base = c; radius = r; height = h; resolution = res; axis = a; SetupShape(); }
void cylinder::SetCylinder(point c, float r, float h, int res, int a, bool capped) { base = c; radius = r; height = h; axis = a; resolution = res; SetupShape(); }
void cone::Read(Loader &input) { char token[MAX_INPUT_LENGTH]; bool moreTokens; do { input.PeekTokens(token, 1); moreTokens = true; if (strcmp(token, "base") == 0) { input.ReadToken(token); for (int i = 0; i < 3; i++) if (!input.ReadFloat(base[i])) input.Error("Not enough parameters for cone's base in cone '%s'", objectName); } else if (strcmp(token, "radius") == 0) { input.ReadToken(token); if (!input.ReadFloat(radius)) input.Error("Error reading radius in cone '%s'", objectName); } else if (strcmp(token, "height") == 0) { input.ReadToken(token); if (!input.ReadFloat(height)) input.Error("Error reading height in cone '%s'", objectName); } else if (strcmp(token, "axis") == 0) { input.ReadToken(token); if (!input.ReadInt(axis)) input.Error("Error reading axis number in cone '%s'", objectName); } else if (strcmp(token, "capped") == 0) { input.ReadToken(token); if (!input.ReadBool(capped)) input.Error("Error reading height in cone '%s'", objectName); } else if (strcmp(token, "resolution") == 0) { input.ReadToken(token); if (!input.ReadInt(resolution)) input.Error("Error reading resolution in cone '%s'", objectName); } else moreTokens = false; // If we don't recognize it jump out ... it is an attribute } while (moreTokens); SetupShape(); }
BOOL RectangleRecordHandler::ReadRectangleComplexRoundedStellatedReformed(CXaraFileRecord *pCXaraFileRecord) { BOOL ok = TRUE; NodeRegularShape * pRectangle; DocCoord MajorAxis; DocCoord MinorAxis; Matrix TransformMatrix; double StellationRadius; double StellationOffset; double PrimaryCurvature; double SecondaryCurvature; pRectangle = new NodeRegularShape; if (ok) ok = SetupShape(pRectangle); if (ok) ok = SetNumberOfSides(pRectangle, NumberOfSides); if (ok) ok = SetIsRounded(pRectangle, TRUE); if (ok) ok = SetIsStellated(pRectangle, TRUE); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); if (ok) ok = SetMajorAxis(pRectangle, MajorAxis); if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); if (ok) ok = SetMinorAxis(pRectangle, MinorAxis); if (ok) ok = pCXaraFileRecord->ReadMatrix(&TransformMatrix); if (ok) ok = SetTransformMatrix(pRectangle, TransformMatrix); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationRadius); if (ok) ok = SetStellationRadius(pRectangle, StellationRadius); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationOffset); if (ok) ok = SetStellationOffset(pRectangle, StellationOffset); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&PrimaryCurvature); if (ok) ok = SetPrimaryCurvature(pRectangle, PrimaryCurvature); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&SecondaryCurvature); if (ok) ok = SetSecondaryCurvature(pRectangle, SecondaryCurvature); if (ok) ok = pCXaraFileRecord->ReadPath(&(pRectangle->EdgePath1)); if (ok) ok = pCXaraFileRecord->ReadPath(&(pRectangle->EdgePath2)); if (ok) ok = InvalidateCache(pRectangle); if (ok) ok = InsertNode(pRectangle); return ok; }
void sphere::Read(Loader &input) { char token[MAX_INPUT_LENGTH]; bool moreTokens; do { // We need to "peek" because if the token isn't giving us one // of the sphere properties, then it is a shape attribute like // color and if we've already read it out of the file, the shape // class would not be able to read the attribute afterwords. // So we "peek" at the token which does not remove it from the // file stream. For more information, see the "PeekTokens" // method defined in the Loader class input.PeekTokens(token, 1); moreTokens = true; if (strcmp(token, "center") == 0) { input.ReadToken(token); for (int i = 0; i < 3; i++) if (!input.ReadFloat(center[i])) input.Error("Not enough parameters for sphere's center in sphere '%s'", objectName); } else if (strcmp(token, "radius") == 0) { input.ReadToken(token); if (!input.ReadFloat(radius)) input.Error("Error reading radius in sphere '%s'", objectName); } else if (strcmp(token, "resolution") == 0) { input.ReadToken(token); if (!input.ReadInt(resolution)) input.Error("Error reading resolution in sphere '%s'", objectName); } else moreTokens = false; // If we don't recognize it jump out ... it is an attribute } while (moreTokens); SetupShape(); }