In the previous post I wrote about TPSQLPointField class introduced in the upcoming PostgresDAC v2.6.0. Today let me describe TPSQLBoxField which encapsulates box PostgreSQL geometric type.
Some internals
AS well as PostgreSQL point type uses floating-point numbers, box type uses the same approach. Thus we cannot use standard Delphi TRect type, which uses integer numbers. So the new TPSQLBox record type were introduced with constant representing degenerate figure where all vertices are located at the same point. We called it OriginBox similarly to OriginPoint for TPSQLPointField:
type TPSQLBox = packed record case Integer of 0: (Right, Top, Left, Bottom: Double); 1: (TopRight, BottomLeft: TPSQLPoint); end; const OriginBox: TPSQLBox = (Right: 0.0; Top: 0.0; Left: 0.0; Bottom: 0.0); |
For new TPSQLBoxField class TNumericField class were chosen as the ancestor, because of properties for formatting numeric data for display and editing purposes.
Implementation
So we have such definition:
TPSQLPointField = class(TNumericField) public property AsTPoint: TPoint read GetAsTPoint write SetAsTPoint; property Value: TPSQLPoint read GetAsPoint write SetAsPoint; end; |
As you can see Value property is redeclared, now it is of TPSQLBox type. The same behaviour is common for all TField descendants.
We decided to add support for TRect type standard type. So the new AsTPoint property were added.
![]() |
Float numbers are rounded (not truncated) when accessing this value. |
Test Drive
You may test the new functionality by downloading Beta of PostgresDAC-2.6.0 directly from the MicroOLAP site. Please feel free to contact Support Team at your earliest convenience with the questions or proposals.
Filed under: PostgresDAC Tagged: component, Delphi, development, geometry, PostgresDAC, PostgreSQL, TField
