乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 31|回复: 1

问获取当前视口(Viewport)坐标值的函数

[复制链接]

1

主题

8

帖子

2

银币

初来乍到

Rank: 1

铜币
12
发表于 2005-3-2 17:11:00 | 显示全部楼层 |阅读模式
rt

3x a lot!
回复

使用道具 举报

1

主题

8

帖子

2

银币

初来乍到

Rank: 1

铜币
12
发表于 2005-3-3 10:36:00 | 显示全部楼层
在ObjectARX Developer's
Guide 里找到了
Example
3: Obtaining the Window Coordinates
This example shows the use of AcGiViewportDraw::polylineDc() and AcGiViewport::getViewportDcCorners() to obtain the display
coordinates of the viewport. This function is convenient when you are drawing
graphics that depend on the physical layout of the viewport, such as icons
and markers that vary with the size or borders of the viewport. The graphics
drawn will change with panning and zooming. The example draws a box in the upper-right corner of the viewport. The box's width
and height are always one-tenth of the viewport's shortest dimension, and the
box is centered one-tenth of the viewport's shortest dimension down and to the
left of the upper-right-hand corner of the viewport:
void
AsdkIconSamp::viewportDraw(AcGiViewportDraw* pV)
{
    // Get the current viewport's display coordinates.
    //
    AcGePoint2d lower_left, upper_right;
    pV->viewport().getViewportDcCorners(lower_left, upper_right);
           double xsize = upper_right.x - lower_left.x;
           double ysize = upper_right.y - lower_left.y;
           xsize /= 10.0;
           ysize /= 10.0;
           double xcenter = upper_right.x - xsize;
           double ycenter = upper_right.y - ysize;
           double half_xsize = xsize / 2.0;
           double half_ysize = ysize / 2.0;
           // Create a unit square.
           //
           const int num_verts = 5;
           AcGePoint3d verts[num_verts];
           for (int i = 0; i subEntityTraits().setColor(kRed);
    pV->geometry().polylineDc(num_verts, verts);
}
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 07:34 , Processed in 0.424932 second(s), 67 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表