The point object does not store the appearance and size of a point. The database stores the appearance and size of all points in the PDMODE and PDSIZE system variables.
The Point Mode property defines the appearance of points to be drawn as an Integer value. The mode is selected from a fixed list. Values 0, 2, 3, and 4 specify a figure to be drawn through the point. A value of 1 specifies that nothing is drawn. Values in the ranges 32 to 36, 64 to 68, and 96 to 100 specify a shape to be drawn around the point, in addition to the figure drawn through it. The point mode is zero by default.
To get the point mode, use the getPDMODE() method of the database object which does not have arguments and returns the value of the PDMODE system variable. For example:
OdInt16 mode = pDb->getPDMODE();
odPrintConsoleString(L"\nPoint mode = %d", mode);
To set the point mode, use the setPDMODE() method of the database object which requires the number of the mode as an argument of an Integer type and does not return a value. If a value is out of the range, errors occur. For example:
// pin & square
pDb->setPDMODE(68);
// dot
pDb->setPDMODE(0);
The Point Size property defines the size of the point figure in relative or absolute units, except when the point mode is set to 0 or 1. When the size value is negative, it specifies the point size at a percent of the viewport size. When the size value is positive, it specifies the absolute point size in drawing units. When the size value is zero, it specifies the point size at 5 percent of the drawing area height. When the point size is absolute, all points are displayed larger or smaller for zooming in and out. When the point size is relative, all points are not changed for zooming in and out. The point size is zero by default.
To get the point size, use the getPDSIZE() method of the database object which does not have arguments and returns the value of the PDSIZE system variable. For example:
double size = pDb->getPDSIZE();
odPrintConsoleString(L"\nPoint size = %g", size);
To set the point size, use the setPDSIZE() method of the database object which requires the size value as an argument of a Double type and does not return a value. For example:
// Absolute size in drawing units
pDb->setPDSIZE(0.5);
// Relative size in percentage
pDb->setPDSIZE(-5);
// Default size
pDb->setPDSIZE(0);
The AboutPDMODE() function requires a point mode as an Integer argument and returns a string about the appearance of the point as an OdString value. The function declares the variable of the OdString type and uses the format() method to convert the mode value to a string and the switch–case statement to select a string about a point mode. The AboutPDMODE() function has the following implementation:
OdString AboutPDMODE(OdInt16 mode)
{
OdString sInfo;
sInfo.format(L"%d - ", mode);
switch(mode)
{
case 0: sInfo += L"dot"; break;
case 1: sInfo += L"empty"; break;
case 2: sInfo += L"plus"; break;
case 3: sInfo += L"cross"; break;
case 4: sInfo += L"pin"; break;
case 32: sInfo += L"dot & circle"; break;
case 33: sInfo += L"circle"; break;
case 34: sInfo += L"plus & circle"; break;
case 35: sInfo += L"cross & circle"; break;
case 36: sInfo += L"pin & circle"; break;
case 64: sInfo += L"point & square"; break;
case 65: sInfo += L"square"; break;
case 66: sInfo += L"plus & square"; break;
case 67: sInfo += L"cross & square"; break;
case 68: sInfo += L"pin & square"; break;
case 96: sInfo += L"dot & circle & square"; break;
case 97: sInfo += L"circle & square"; break;
case 98: sInfo += L"plus & circle & square"; break;
case 99: sInfo += L"cross & circle & square"; break;
case 100: sInfo += L"pin & circle & square"; break;
default: sInfo += L"???";
}
return sInfo;
}
The EntryPDMODE() function requires a reference to a variable in which the selected point mode must be saved as an argument of an Integer type and returns True when entry is successful or False when the user cancels the entry. The function organizes a loop in which it displays the available modes and inquires about a mode number. If an entered value is incorrect, the function displays an error message and repeats the entry. If the entered value is correct, the function returns the selected point mode through its own argument and True as a result. The EntryPDMODE() function has the following implementation:
bool EntryPDMODE(OdInt16& mode)
{
wchar_t ch;
OdInt16 newmode;
do {
wcout << L"\n0 - dot";
wcout << L"\n1 - empty";
wcout << L"\n2 - plus";
wcout << L"\n3 - cross";
wcout << L"\n4 - pin";
wcout << L"\n32 - dot & circle";
wcout << L"\n33 - circle";
wcout << L"\n34 - plus & circle";
wcout << L"\n35 - cross & circle";
wcout << L"\n36 - pin & circle";
wcout << L"\n64 - dot & square";
wcout << L"\n65 - square";
wcout << L"\n66 - plus & square";
wcout << L"\n67 - cross & square";
wcout << L"\n68 - pin & square";
wcout << L"\n96 - dot & circle & square";
wcout << L"\n97 - circle & square";
wcout << L"\n98 - plus & circle & square";
wcout << L"\n99 - cross & circle & square";
wcout << L"\n100- pin & circle & square";
wcout << L"\nEntry the point mode number:>";
wcin >> newmode;
if(!wcin.fail() && wcin.peek() == 10)
{
if((newmode >= 0 && newmode <= 4) || (newmode >= 32 && newmode <= 36) ||
(newmode >= 64 && newmode <= 68) || (newmode >= 96 && newmode <= 100))
{
mode = newmode;
return true;
}
}
else { wcin.clear(); wcin.sync(); }
wcout << L"Error: Invalid entered value\nEntry any key to repeat [or Q-quit]:>";
wcin >> ch;
}
while(ch != L'Q' && ch != L'q');
return false;
}
Note: The PDMODE and PDSIZE system variables influence all points of a drawing (new and existing).
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|