#include <valfunc.h>
Inheritance diagram for ValueFunctionBlip:
Public Member Functions | |
ValueFunctionBlip (double MaxPosition=0.50) | |
Constructor. | |
virtual double | GetValue (double Position) |
To read the value of this function at a given position. | |
virtual ValueFunction * | Clone (void) |
Clone operator. Creates an exact copy of this object. | |
virtual BOOL | IsDifferent (ValueFunction *pOther) |
Comparator. Determines if 2 different ValueFunction objects are considered different. | |
virtual CamelotFileRecord * | WriteFileRecord (INT32 RecordTag, INT32 ExtraBytes, BaseCamelotFilter *pFilter) |
Saves a ValueFunction object to a Xara file. This function will create a new variable-sized record with the given record tag, and will write out whatever data is needed to save this ValueFunction's state to the file. | |
virtual ValueFunctionID | GetUniqueID (void) |
Protected Member Functions | |
virtual ValueFunction * | CreateAndReadFileRecord (CXaraFileRecord *pInputRecord) |
Loads a ValueFunction object from a record which was saved into a file using the WriteFileRecord call. This is called by the base class loader routine ReadFileRecord, which finds an appropriate instance of a derived class to call to load the data in question. | |
virtual ValueFunctionBlip * | CreateInstance (void) |
Creates a new blank object of the same type as this one. Internal function used in ValueFunctionBlip & ValueFunctionBlipS. | |
Protected Attributes | |
double | MaxPos |
Private Member Functions | |
CC_DECLARE_DYNAMIC (ValueFunctionBlip) |
Classes derived from this override the "blip" with different shapes
In all cases, the constructor takes a "maxposition" value which indicates at which position the maximum function value occurs, as some blips are not symmetrical.
Definition at line 662 of file valfunc.h.
|
Constructor.
Definition at line 2279 of file valfunc.cpp. 02280 { 02281 ERROR3IF(MaxPosition <= 0.0 || MaxPosition >= 1.0, "Silly MaxPosition value"); 02282 MaxPos = MaxPosition; 02283 }
|
|
|
|
Clone operator. Creates an exact copy of this object.
Implements ValueFunction. Definition at line 2336 of file valfunc.cpp. 02337 { 02338 ValueFunctionBlip *pClone = CreateInstance(); 02339 02340 if (pClone != NULL) 02341 pClone->MaxPos = MaxPos; 02342 02343 return(pClone); 02344 }
|
|
Loads a ValueFunction object from a record which was saved into a file using the WriteFileRecord call. This is called by the base class loader routine ReadFileRecord, which finds an appropriate instance of a derived class to call to load the data in question.
Implements ValueFunction. Definition at line 2479 of file valfunc.cpp. 02480 { 02481 ERROR3IF(pInputRecord == NULL, "Illegal NULL param"); 02482 02483 float MaxPosition = (float)0.5; 02484 pInputRecord->ReadFLOAT(&MaxPosition); 02485 02486 ValueFunctionBlip *pBlip = CreateInstance(); 02487 if (pBlip != NULL) 02488 pBlip->MaxPos = MaxPosition; 02489 02490 return(pBlip); 02491 }
|
|
Creates a new blank object of the same type as this one. Internal function used in ValueFunctionBlip & ValueFunctionBlipS.
Reimplemented in ValueFunctionTeardrop, ValueFunctionTeardropCurvedEnd, ValueFunctionEllipse, and ValueFunctionThumbtack. Definition at line 2515 of file valfunc.cpp. 02516 { 02517 return(new ValueFunctionBlip); 02518 }
|
|
Implements ValueFunction. Reimplemented in ValueFunctionTeardrop, ValueFunctionTeardropCurvedEnd, ValueFunctionEllipse, and ValueFunctionThumbtack. Definition at line 675 of file valfunc.h. 00675 { return(ValueFunctionID_Blip); };
|
|
To read the value of this function at a given position.
Implements ValueFunction. Reimplemented in ValueFunctionTeardrop, ValueFunctionTeardropCurvedEnd, ValueFunctionEllipse, and ValueFunctionThumbtack. Definition at line 2304 of file valfunc.cpp. 02305 { 02306 double Value; 02307 if (Position < MaxPos) 02308 { 02309 Position /= MaxPos; 02310 Value = sin(Position * (Pi / 2.0)); 02311 } 02312 else 02313 { 02314 Position = (Position - MaxPos) / (1.0 - MaxPos); 02315 Value = cos(Position * (Pi / 2.0)); 02316 } 02317 02318 return(Value); 02319 }
|
|
Comparator. Determines if 2 different ValueFunction objects are considered different.
Reimplemented from ValueFunction. Definition at line 2369 of file valfunc.cpp. 02370 { 02371 if (ValueFunction::IsDifferent(pOther)) 02372 return(TRUE); 02373 02374 // Both objects are instances of this class, so compare them more carefully 02375 return(MaxPos != ((ValueFunctionBlip *)pOther)->MaxPos); 02376 }
|
|
Saves a ValueFunction object to a Xara file. This function will create a new variable-sized record with the given record tag, and will write out whatever data is needed to save this ValueFunction's state to the file.
All ValueFunction record data has 3 sections, whiich are recorded as follows: 1. ValueFunction header, identifying which type of VF is being saved INT32 ValueFunctionUniqueID (4 bytes) 2. Derived-class-data (0 or more bytes). This particular class adds: float MaxPosition (4 bytes) 3. Caller data. This is written by the caller to the returned record object. This data must be ExtraBytes (0 or more) bytes in length.
Implements ValueFunction. Definition at line 2422 of file valfunc.cpp. 02424 { 02425 ERROR3IF(pFilter == NULL, "Illegal NULL param"); 02426 ERROR3IF(ExtraBytes < 0, "Stupid ExtraBytes request in ValueFunction::WriteFileRecord"); 02427 02428 // Calculate how many bytes of information this VF will write. We do not include 02429 // the header info written by the base class or the ExtraInfo desired by the caller - 02430 // the base class adds all that in for us. 02431 const INT32 MyRecordSize = 4; 02432 02433 // Create an appropriate record, and write our data to it 02434 CamelotFileRecord *pRec = CreateAndWriteFileRecord(RecordTag, MyRecordSize, ExtraBytes, pFilter); 02435 02436 if (pRec != NULL) 02437 { 02438 // Write out our ValueFunction's specific data. If it fails, then we'll return NULL 02439 if (!pRec->WriteFLOAT((float)MaxPos)) 02440 { 02441 delete pRec; 02442 pRec = NULL; 02443 } 02444 } 02445 02446 return(pRec); 02447 }
|
|
|