同步操作将从 腾硕软件/vc-client 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "StdAfx.h"#include "WFConnect.h"#define _USE_MATH_DEFINES#include <cmath>WFConnect::WFConnect(void){m_src=NULL;m_dst=NULL;m_from.X=0.0F;m_from.Y=0.0F;m_to.X=0.0F;m_to.Y=0.0F;m_selected=FALSE;m_color=DEFAULT_BGCOLOR;m_pPath=NULL;m_pRgn=NULL;}BOOL WFConnect::Draw(Graphics& graphics){CalcMe(graphics);Pen pen(Color(GetRValue(this->m_color),GetGValue(this->m_color),GetBValue(this->m_color)),1.3F);AdjustableArrowCap arr(3.0F,3.0F,TRUE);pen.SetEndCap(LineCapCustom);pen.SetCustomEndCap(&arr);graphics.DrawLine(&pen,this->m_from,this->m_to);return TRUE;}BOOL WFConnect::IsInRegion(Point pt,Graphics* graphics){if(!this->m_pPath) return FALSE;return m_pPath->IsVisible(pt,graphics);}BOOL WFConnect::CalcMe(Graphics& graphics){if(this->m_selected){this->m_color=DEFAULT_BGCOLOR_HOT;}else{this->m_color=DEFAULT_BGCOLOR;}//开始节点中心位置float x1=m_src->m_pRC->X+m_src->m_pRC->Width/2.0F;float y1=m_src->m_pRC->Y+m_src->m_pRC->Height/2.0F;//目标节点中心位置float x2=m_dst->m_pRC->X+m_dst->m_pRC->Width/2.0F;float y2=m_dst->m_pRC->Y+m_dst->m_pRC->Height/2.0F;//计算连接起止点float theta = ::atan2f(y2 - y1, x2 - x1);this->m_from= GetPoint(theta, m_src->m_pRC);this->m_to= GetPoint(theta+3.14F, m_dst->m_pRC);//初始化用于判断选中状态的GraphicsPathSAFE_DEL_PTR(m_pPath);this->m_pPath=new GraphicsPath();this->m_pPath->AddLine(this->m_from,this->m_to);Pen pen(Color(255,255,255),8);this->m_pPath->Widen(&pen);this->m_pPath->CloseFigure();SAFE_DEL_PTR(m_pRgn);this->m_pRgn=new Region(this->m_pPath);return TRUE;}PointF WFConnect::GetPoint(float theta,RectF* r){float cx = r->X+r->Width/2.0F;float cy = r->Y+r->Height/2.0F;float w = r->Width/2.0F;float h = r->Height/2.0F;float d =::sqrtf(w*w+h*h);float x = cx + d*::cos(theta);float y = cy + d*::sin(theta);PointF p(0.0F,0.0F);if(x<r->X){ //OUT_LEFTp.X = cx - w;p.Y = cy - w*((y-cy)/(x-cx));}else if(x>(r->X +r->Width)){ //OUT_RIGHTp.X = cx + w;p.Y = cy + w*((y-cy)/(x-cx));}else if(y < r->Y){ //OUT_TOPp.X = cx - h*((x-cx)/(y-cy));p.Y = cy - h;}else if(y >( r->Y +r->Height)){ //OUT_BOTTOMp.X = cx + h*((x-cx)/(y-cy));p.Y = cy + h;}return p;}WFConnect::~WFConnect(void){SAFE_DEL_PTR(m_pRgn);SAFE_DEL_PTR(m_pPath);}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。