void DemoRPlan (HANDLE hLcWnd)
{
int Side;
double Len, Dist, X, Y, X2, Y2, DirAng, Ang, Step;
WCHAR szText[32];
HANDLE hVer[6], hRPlan, hBlock, hDrw;
// get drawing and block, linked with CAD window
hDrw = lcPropGetHandle( hLcWnd, LC_PROP_WND_DRW );
hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );
// create empty object
hRPlan = lcBlockAddRPlan( hBlock );
// add vertices
hVer[0] = lcRPlanAddVer( hRPlan, 0,120 );
hVer[1] = lcRPlanAddVer( hRPlan, 200,0 );
hVer[2] = lcRPlanAddVer( hRPlan, 500,420 );
hVer[3] = lcRPlanAddVer( hRPlan, 830,450 );
hVer[4] = lcRPlanAddVer( hRPlan, 1000,100 );
hVer[5] = lcRPlanAddVer( hRPlan, 1300,0 );
// define curves
lcRPlanSetCurve( hVer[1], 100,50,50 );
lcRPlanSetCurve( hVer[2], 250,70,70 );
lcRPlanSetCurve( hVer[3], 100,50,50 );
lcRPlanSetCurve( hVer[4], 500,0,0 );
// Now we will add distance markers along the road
// set current color
lcPropPutStr( hDrw, LC_PROP_DRW_COLOR, L"blue" );
// get road length
Len = lcPropGetFloat( hRPlan, LC_PROP_RPLAN_LEN );
Step = 100.0;
Dist = 0.0;
while( Dist < Len ){
// get on-road point (X,Y) by distance from beginning
lcRPlanGetPoint( hRPlan, Dist, &X, &Y, &DirAng, &Side );
// add line and text at this position
Ang = DirAng - LC_DEG90;
lcGetPolarPoint( X, Y, Ang, 5.0, &X2, &Y2 );
lcBlockAddLine( hBlock, X, Y, X2, Y2 );
lcGetPolarPoint( X, Y, Ang, 10.0, &X2, &Y2 );
swprintf( szText, L"%.1f", Dist );
lcBlockAddText2( hBlock, szText, X2, Y2, LC_TA_LEFCEN, 3.0, 1.0, Ang, 0.0 );
Dist += Step;
}
// make the picture visible in a window
lcBlockUpdate( hBlock, true, 0 );
lcWndExeCommand( hWnd, LC_CMD_ZOOM_EXT, 0 );
}