{"id":22076327,"url":"https://github.com/pengfeiw/mimiccadcanvas","last_synced_at":"2025-07-24T13:30:49.003Z","repository":{"id":130075329,"uuid":"174461582","full_name":"pengfeiw/MimicCADCanvas","owner":"pengfeiw","description":"The userControl which mimic cad canvas.Include zooming 、hightlighting and save screenshort into docx file.","archived":false,"fork":false,"pushed_at":"2022-01-29T05:53:55.000Z","size":1550,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-10-20T22:18:38.857Z","etag":null,"topics":["csharp","graphics-programming","winform"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pengfeiw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-03-08T03:20:07.000Z","updated_at":"2023-10-20T22:18:39.278Z","dependencies_parsed_at":null,"dependency_job_id":"4d7a806c-401d-4d03-95a1-0430762dfbeb","html_url":"https://github.com/pengfeiw/MimicCADCanvas","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengfeiw%2FMimicCADCanvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengfeiw%2FMimicCADCanvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengfeiw%2FMimicCADCanvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengfeiw%2FMimicCADCanvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pengfeiw","download_url":"https://codeload.github.com/pengfeiw/MimicCADCanvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227440935,"owners_count":17776660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","graphics-programming","winform"],"created_at":"2024-11-30T22:14:00.301Z","updated_at":"2024-11-30T22:14:01.162Z","avatar_url":"https://github.com/pengfeiw.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThe userControl which mimic cad canvas.Include zooming 、hightlighting and save screenshort into docx file.\n\n# CoordTransform\n\n首先，看一下 `CoordTransform` 类的原型，着重看一下它的成员变量的意思。\n\n```csharp\npublic class CoordTransform\n{   \n    // 世界坐标系中一个单位长度与设备坐标系中一个单位长度的比值\n    private double m_WcsToDcs = 1.0;\n    // m_WcsToDcs 的倒数 \n    private double m_DcsToWcs = 1.0;\n    // 设备坐标系的原点，在世界坐标系中的坐标\n    private PointF m_WndOrg = new PointF(); // Point which is mapped to window origin in world coordinate system\n    // 缩放上下限，缩放倍数最大不超过100，最小不超过 1 / 100\n    private double m_ZoomLimit = 100;\n\n    //public CoordTransform() { }\n    public void ViewAll(RectangleF bbox, RectangleF wndRect, int margin/*pixel*/){}\n\n    public bool Set(PointF wndOrg, double wcsToDcs){}\n\n    public void Pan(PointF lastPoint, PointF curPoint){}\n\n    public bool Zoom(Point mousePos, int delta){}\n\n    public void SetLimit(double limit){}\n    public PointF WcsToDcs(PointF point){}\n    public PointF DcsToWcs(PointF point){}\n    public double WlToDl(double len){}\n    public double DlToWl(double len){}\n}\n```\n\n所有的图元坐标定义在世界坐标系中。 \n\n我们以一条线段 `(0,0)`, `(100, 100)` 为例，初始状态下 `m_WndOrg = (0, 0)`, `m_WcsToDcs = 1`。\n\n## `m_WcsToDcs` 与 `m_DcsToWcs`\n\n\u003e 存储世界坐标系与设备坐标系之间的长度比例关系，这个可以用来控制缩放\n\n当 `m_WcsToDcs = 2` 时，表示世界作标系的 1 个单位长度等于设备坐标系中 2 个单位长度。 此时如果没有发生平移，即 `m_WndOrg = (0, 0)`，那么线段的设备坐标就是`(0, 0)` 和 `(200, 200)`，此时我们看到的线段就是放大了 2 倍。\n\n## `m_WndOrg`\n\n\u003e 存储世界坐标系与设备坐标系位置关系，这个可以用来控制平移\n\n当 `m_WndOrg = (100, 100)` 时，表示设备坐标系的原点在世界坐标系中 `(100, 100)` 位置。此时如果没有发生缩放，即 `m_WcsToDcs = 1`, 那么线段的设备坐标就是`(-100, -100)` 和 `(0, 0)`。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengfeiw%2Fmimiccadcanvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpengfeiw%2Fmimiccadcanvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengfeiw%2Fmimiccadcanvas/lists"}