Skip to content

Commit db04c52

Browse files
authored
Merge pull request #34 from X-Plane/wed_260_mroe_patches
Wed 260 mroe patches
2 parents 912aa3c + 338f970 commit db04c52

File tree

8 files changed

+182
-51
lines changed

8 files changed

+182
-51
lines changed

src/DSFTools/DSF2Text.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ static bool Text2DSFWithWriterAny(const char * inFileName, const char * inDSF, D
416416

417417
DSFRasterHeader_t rheader;
418418

419-
char buf[512];
420-
char prop_id[512];
421-
char prop_value[512];
419+
char buf[4096];
420+
char prop_id[4096];
421+
char prop_value[4096];
422422

423423
DSFCallbacks_t cbs;
424424
void * writer;

src/Interfaces/IControlHandles.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ enum LinkType_t {
8181
link_Solid, // Draw solid line...
8282
link_BezierCtrl, // Thin line for bezier handles
8383
link_Ghost, // implicit ghost line
84-
link_Marquee
84+
link_Marquee,
85+
link_Handle // link can be virtual a handle
8586
};
8687

8788
class IControlHandles : public virtual IBase {

src/WEDEntities/WED_GISChain.cpp

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include "WED_GISChain.h"
2525
#include "WED_AirportNode.h"
2626
#include "WED_FacadeNode.h"
27+
#include "WED_FacadeRing.h"
28+
#include "WED_FacadePlacement.h"
2729

2830
TRIVIAL_COPY(WED_GISChain, WED_Entity)
2931

@@ -178,7 +180,7 @@ IGISPoint * WED_GISChain::SplitSide (const Point2& p, double dist)
178180
WED_Thing * np = dynamic_cast<WED_Thing*>(GetNthChild(best)->Clone());
179181
IGISPoint * npp = dynamic_cast<IGISPoint *>(np);
180182
IGISPoint_Bezier * nppb = dynamic_cast<IGISPoint_Bezier*>(np);
181-
183+
182184
if(is_b)
183185
{
184186
DebugAssert(nppb);
@@ -205,7 +207,7 @@ IGISPoint * WED_GISChain::SplitSide (const Point2& p, double dist)
205207
}
206208
// Why wait? Cuz...Getside on old side will USE this as soon as we are its parent!
207209
np->SetParent(this, best+1);
208-
210+
209211
return npp;
210212
}
211213
return NULL;
@@ -291,7 +293,7 @@ void WED_GISChain::RebuildCache(int flags) const
291293
mCachePts.reserve(nc);
292294
mCachePtsBezier.reserve(nc);
293295
mHasUV = nc > 0;
294-
296+
295297
int n;
296298
for (n = 0; n < nc; ++n)
297299
{
@@ -322,7 +324,7 @@ void WED_GISChain::RebuildCache(int flags) const
322324
//
323325
// What would be better would be to have the cache flags SPECIFIC to certain operations so
324326
// that it was unambiguous that GetBounds() is the right call to address a particular flag.
325-
327+
326328
int m = GetNumPoints();
327329
for(int mm = 0; mm < m; ++mm)
328330
{
@@ -332,11 +334,11 @@ void WED_GISChain::RebuildCache(int flags) const
332334
if(p)
333335
p->GetBounds(gis_Geo, temp);
334336
}
335-
337+
336338
int n = GetNumSides(); // We MUST ensure that this only builds topo cache or we are dead dead dead!!
337339
mCacheBounds = Bbox2();
338340
mCacheBoundsUV = Bbox2();
339-
341+
340342
for (int i = 0; i < n; ++i)
341343
{
342344
Bezier2 b;
@@ -353,28 +355,28 @@ void WED_GISChain::RebuildCache(int flags) const
353355
mCacheBoundsUV += bb;
354356
}
355357
}
356-
358+
357359
}
358360
}
359361

360362
void WED_GISChain::Reverse(GISLayer_t l)
361363
{
362364
RebuildCache(CacheBuild(cache_Topological));
363365
int n,t,np = GetNumPoints();
364-
366+
365367
// Sanity checking: our point count, and our cache really should
366368
// be in size sync. Then make sure that we are CONSISTENT in our
367369
// having or not having beziers. Heterogeneous _types_ of points
368370
// are not what we want!
369371
DebugAssert(mCachePtsBezier.size() == mCachePts.size());
370372
DebugAssert(mCachePtsBezier.size() == np);
371-
373+
372374
bool has_bezier = mCachePtsBezier[0] != NULL;
373375
for(n = 1; n < np; ++n)
374376
{
375377
Assert(has_bezier == (mCachePtsBezier[n] != NULL));
376378
}
377-
379+
378380
vector<Point2> p(np);
379381
vector<Point2> p_l(np);
380382
vector<Point2> p_h(np);
@@ -397,7 +399,7 @@ void WED_GISChain::Reverse(GISLayer_t l)
397399
{
398400
t = np - n - 1;
399401
mCachePts[t]->SetLocation(l, p[n]);
400-
402+
401403
if(has_bezier)
402404
{
403405
mCachePtsBezier[t]->SetSplit(split[n]);
@@ -409,10 +411,10 @@ void WED_GISChain::Reverse(GISLayer_t l)
409411
else mCachePtsBezier[t]->DeleteHandleLo();
410412
}
411413
}
412-
414+
413415
// On Airport Lines and Taxiways, we want to preserve the line/light properties of each segment, effectivly ONLY reversing the node sequence.
414416
// Very usefull when reversing airport lines with differently tagged segments. It effectively brings the blue taxiway edge lights to the other side ONLY.
415-
417+
416418
if (dynamic_cast <WED_AirportNode *> (GetNthChild(0)))
417419
{
418420
for(n = 0; n < np/2; ++n) // directly swap the attributes of the nodes. No need to first build a local copy and then write it back in reverse order.
@@ -421,7 +423,7 @@ void WED_GISChain::Reverse(GISLayer_t l)
421423
WED_AirportNode * a_n = dynamic_cast <WED_AirportNode *> (GetNthChild(n)); // note to self: mCache would yield no speedup here, as we dynamic_cast every point only once
422424
WED_AirportNode * a_t = dynamic_cast <WED_AirportNode *> (GetNthChild(t)); // thus we get away with NOT expanding RebuildCache to work for 'gis_Apt" layers :)
423425
set<int> tmp1, tmp2;
424-
426+
425427
a_n->GetAttributes(tmp1);
426428
a_t->GetAttributes(tmp2);
427429
a_n->SetAttributes(tmp2);
@@ -436,30 +438,30 @@ void WED_GISChain::Reverse(GISLayer_t l)
436438
WED_FacadeNode * a_n = dynamic_cast <WED_FacadeNode *> (GetNthChild(n)); // note to self: mCache would yield no speedup here, as we dynamic_cast every point only once
437439
WED_FacadeNode * a_t = dynamic_cast <WED_FacadeNode *> (GetNthChild(t)); // thus we get away with NOT expanding RebuildCache to work for 'gis_Apt" layers :)
438440
int tmp1, tmp2;
439-
441+
440442
tmp1 = a_n->GetWallType();
441443
tmp2 = a_t->GetWallType();
442444
a_n->SetWallType(tmp2);
443445
a_t->SetWallType(tmp1);
444446
}
445447
}
446-
448+
447449
}
448450

449451
void WED_GISChain::Shuffle(GISLayer_t l)
450452
{
451453
RebuildCache(CacheBuild(cache_Topological));
452454
int n,t,np = GetNumPoints();
453-
455+
454456
DebugAssert(mCachePtsBezier.size() == mCachePts.size());
455457
DebugAssert(mCachePtsBezier.size() == np);
456-
458+
457459
bool has_bezier = mCachePtsBezier[0] != NULL;
458460
for(n = 1; n < np; ++n)
459461
{
460462
Assert(has_bezier == (mCachePtsBezier[n] != NULL));
461463
}
462-
464+
463465
vector<Point2> p(np);
464466
vector<Point2> p_l(np);
465467
vector<Point2> p_h(np);
@@ -477,7 +479,7 @@ void WED_GISChain::Shuffle(GISLayer_t l)
477479
split[n] = mCachePtsBezier[n]->IsSplit();
478480
}
479481
}
480-
482+
481483
for(n = 0; n < np; ++n)
482484
{
483485
t = (n + 1) % np;
@@ -491,10 +493,30 @@ void WED_GISChain::Shuffle(GISLayer_t l)
491493

492494
if (has_hi[n]) mCachePtsBezier[t]->SetControlHandleHi(l, p_h[n]);
493495
else mCachePtsBezier[t]->DeleteHandleHi();
494-
}
496+
}
495497
}
496-
}
498+
// For facades, it makes more sense to keep the wall type in its position and only move the segments so that the very first segment is in the right place.
499+
// Users use this mainly to relocate the “ground contact point” of the facade. w.r.t cache same as for Reverse function above
497500

501+
WED_FacadeNode * fn = dynamic_cast <WED_FacadeNode *> (GetNthChild(np-1));
502+
if (fn)
503+
{
504+
WED_FacadeRing * fr = dynamic_cast <WED_FacadeRing *> (fn->GetParent());
505+
WED_FacadePlacement * f = dynamic_cast <WED_FacadePlacement *> (fr->GetParent());
506+
507+
if(f->HasCustomWalls())
508+
{
509+
int tmp1,tmp2 = fn->GetWallType();
510+
for(n = 0; n < np ; ++n)
511+
{
512+
fn = dynamic_cast <WED_FacadeNode *> (GetNthChild(n));
513+
tmp1 = fn->GetWallType();
514+
fn->SetWallType(tmp2);
515+
tmp2 = tmp1;
516+
}
517+
}
518+
}
519+
}
498520

499521

500522
int WED_GISChain::GetNumEntities(void ) const

src/WEDMap/WED_HandleToolBase.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ void WED_HandleToolBase::ProcessSelection(
505505
if( ((*i)->GetGISClass() == gis_Polygon || (*i)->GetGISClass() == gis_Composite) && (
506506
strcmp((*i)->GetGISSubtype(), "WED_ForestPlacement") == 0 ||
507507
strcmp((*i)->GetGISSubtype(), "WED_ExclusionPoly") == 0 || // take whole exclusion rather than outer ring
508-
strcmp((*i)->GetGISSubtype(), "WED_FacadePlacement") == 0 ) )
508+
strcmp((*i)->GetGISSubtype(), "WED_FacadePlacement") == 0 ) )
509509
{ printf("Forest/Facade\n"); keeper = *i; break; }
510510
}
511511
if(!keeper)
@@ -514,15 +514,15 @@ void WED_HandleToolBase::ProcessSelection(
514514
if( (*i)->GetGISClass() == gis_Line ||
515515
(*i)->GetGISClass() == gis_Edge ||
516516
(*i)->GetGISClass() == gis_Ring || // APT Boundaries, but only the ring part, not the inner area
517-
(*i)->GetGISClass() == gis_Chain )
517+
(*i)->GetGISClass() == gis_Chain )
518518
{ printf("Line\n"); keeper = *i; break; }
519519
}
520520
if(!keeper)
521521
for(set<IGISEntity *> ::iterator i = result.begin(); i != result.end(); ++i) // now the polygons, in similar order as typical LAYER_GROUP assignments
522522
{
523523
if( ((*i)->GetGISClass() == gis_Polygon || (*i)->GetGISClass() == gis_Composite) && (
524524
strcmp((*i)->GetGISSubtype(),"WED_PolygonPlacement") == 0 || // Textured Polys
525-
strcmp((*i)->GetGISSubtype(),"WED_DrapedOrthophoto") == 0 ) )
525+
strcmp((*i)->GetGISSubtype(),"WED_DrapedOrthophoto") == 0 ) )
526526
{ printf("Polygon\n"); keeper = *i; break; } // Draped Polys - also Ground Painted Signs
527527
}
528528
if(!keeper)
@@ -824,6 +824,7 @@ void WED_HandleToolBase::HandleClickUp (int inX, int inY, int inButton, GUI_K
824824
mDragType == drag_Ent)
825825
{
826826
mHandles->EndEdit();
827+
mHandleIndex = -1;
827828
} else if ( mDragType == drag_Create )
828829
this->CreationUp(
829830
GetZoomer()->PixelToLL(Point2(mDragX, mDragY)),
@@ -895,13 +896,21 @@ void WED_HandleToolBase::DrawStructure (bool inCurrent, GUI_GraphState * g)
895896

896897
LinkType_t lt;
897898
mHandles->GetNthLinkInfo(eid,l,NULL, &lt);
899+
900+
if(lt == link_None && mDragType == drag_Links && eid == mHandleEntity && l == mHandleIndex)
901+
{
902+
lt = link_Handle;
903+
}
904+
898905
if (lt != link_None)
899906
{
900907
switch(lt) {
901908
case link_Solid: glColor4fv(WED_Color_RGBA(wed_Link)); break;
902909
case link_BezierCtrl: glColor4fv(WED_Color_RGBA(wed_ControlLink)); break;
903910
case link_Ghost: glColor4fv(WED_Color_RGBA(wed_GhostLink)); break;
904911
case link_Marquee: glColor4fv(WED_Color_RGBA(wed_Marquee)); break;
912+
case link_Handle: glColor4fv(WED_Color_RGBA(wed_ControlHandle)); break;
913+
905914
}
906915
if (ControlLinkToCurve(mHandles,eid,l,b,s,GetZoomer()))
907916
{

src/WEDMap/WED_StructureLayer.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ bool WED_StructureLayer::DrawEntityStructure (bool inCurrent, IGISEntity * ent
101101

102102
WED_Color struct_color = selected ? (locked ? wed_StructureLockedSelected : wed_StructureSelected) :
103103
(locked ? wed_StructureLocked : wed_Structure);
104-
104+
105105
float * colorf = WED_Color_RGBA(struct_color);
106106
glColor4fv(colorf);
107107

@@ -682,6 +682,17 @@ bool WED_StructureLayer::DrawEntityStructure (bool inCurrent, IGISEntity * ent
682682
break;
683683

684684
case gis_Composite:
685+
if(sub_class == WED_FacadePlacement::sClass)
686+
{
687+
if(auto poly = dynamic_cast<IGISPolygon*>(entity))
688+
{
689+
this->DrawEntityStructure(inCurrent, poly->GetOuterRing(), g, selected, locked);
690+
int n = poly->GetNumHoles();
691+
for (int c = 0; c < n; ++c)
692+
this->DrawEntityStructure(inCurrent, poly->GetNthHole(c), g, selected, locked);
693+
}
694+
return false;
695+
}
685696
if(sub_class != WED_AirportBoundary::sClass && sub_class != WED_ExclusionPoly::sClass) // not down-clickable in interior, but still highlighted interior
686697
break;
687698
case gis_Polygon:
@@ -691,10 +702,18 @@ bool WED_StructureLayer::DrawEntityStructure (bool inCurrent, IGISEntity * ent
691702
{
692703
if(auto poly = dynamic_cast<IGISPolygon*>(entity))
693704
{
694-
this->DrawEntityStructure(inCurrent, poly->GetOuterRing(), g, selected, locked);
695-
int n = poly->GetNumHoles();
696-
for (int c = 0; c < n; ++c)
697-
this->DrawEntityStructure(inCurrent, poly->GetNthHole(c), g, selected, locked);
705+
if(sub_class != WED_ExclusionPoly::sClass)
706+
{
707+
ISelection * sel = SAFE_CAST(ISelection, WED_GetSelect(GetResolver()));
708+
IGISPointSequence * ps = poly->GetOuterRing();
709+
this->DrawEntityStructure(inCurrent, ps, g, selected || (sel && sel->IsSelected(ps)), locked);
710+
int n = poly->GetNumHoles();
711+
for (int c = 0; c < n; ++c)
712+
{
713+
ps = poly->GetNthHole(c);
714+
this->DrawEntityStructure(inCurrent, ps, g, selected || (sel && sel->IsSelected(ps)), locked);
715+
}
716+
}
698717

699718
if(selected)
700719
{
@@ -713,6 +732,9 @@ bool WED_StructureLayer::DrawEntityStructure (bool inCurrent, IGISEntity * ent
713732
glPolygon2(pts, false, hole_starts, false);
714733
glFrontFace(GL_CW);
715734
}
735+
736+
if(sub_class == WED_AirportBoundary::sClass)
737+
return false;
716738
}
717739
}
718740
break;

0 commit comments

Comments
 (0)