@@ -46,6 +46,7 @@ T2DMap::T2DMap()
4646 mShiftMode = false ;
4747 mShowInfo = true ;
4848 mShowGrid = true ;
49+ mBubbleMode = true ;
4950}
5051
5152T2DMap::T2DMap (QWidget * parent)
@@ -68,6 +69,7 @@ T2DMap::T2DMap(QWidget * parent)
6869 mShiftMode = false ;
6970 mShowInfo = true ;
7071 mShowGrid = true ;
72+ mBubbleMode = true ;
7173}
7274
7375void T2DMap::init ()
@@ -556,8 +558,8 @@ void T2DMap::paintEvent( QPaintEvent * e )
556558 QList<int > drawnExits;
557559 for ( int i=0 ; i<pArea->rooms .size (); i++ )
558560 {
559- int rx = mpMap->rooms [pArea->rooms [i]]->x *tx+_rx;
560- int ry = mpMap->rooms [pArea->rooms [i]]->y *-1 *ty+_ry;
561+ float rx = mpMap->rooms [pArea->rooms [i]]->x *tx+_rx;
562+ float ry = mpMap->rooms [pArea->rooms [i]]->y *-1 *ty+_ry;
561563 int rz = mpMap->rooms [pArea->rooms [i]]->z ;
562564
563565 if ( rz != zEbene ) continue ;
@@ -627,7 +629,7 @@ void T2DMap::paintEvent( QPaintEvent * e )
627629 exitList.push_back ( mpMap->rooms [pArea->rooms [i]]->northeast );
628630 }
629631
630- drawnExits << exitList;
632+ // drawnExits << exitList;
631633 // drawnExits << pArea->rooms[i]; // exits werden nicht doppelt gezeichnet
632634
633635 QMapIterator<QString, QList<QPointF> > itk (mpMap->rooms [pArea->rooms [i]]->customLines );
@@ -741,8 +743,8 @@ void T2DMap::paintEvent( QPaintEvent * e )
741743 }
742744 else
743745 areaExit = false ;
744- int ex = mpMap->rooms [exitList[k]]->x *tx+_rx;
745- int ey = mpMap->rooms [exitList[k]]->y *ty*-1 +_ry;
746+ float ex = mpMap->rooms [exitList[k]]->x *tx+_rx;
747+ float ey = mpMap->rooms [exitList[k]]->y *ty*-1 +_ry;
746748 int ez = mpMap->rooms [exitList[k]]->z ;
747749 if ( ez != zEbene || e != ez ) continue ;
748750
@@ -897,8 +899,8 @@ void T2DMap::paintEvent( QPaintEvent * e )
897899 qDebug ()<<" ERROR: mapper 2d-draw: area room not in map roomID=" <<pArea->rooms [i] ;
898900 continue ;
899901 }
900- int rx = mpMap->rooms [pArea->rooms [i]]->x *tx+_rx;
901- int ry = mpMap->rooms [pArea->rooms [i]]->y *-1 *ty+_ry;
902+ float rx = mpMap->rooms [pArea->rooms [i]]->x *tx+_rx;
903+ float ry = mpMap->rooms [pArea->rooms [i]]->y *-1 *ty+_ry;
902904 int rz = mpMap->rooms [pArea->rooms [i]]->z ;
903905
904906 if ( rz != zEbene ) continue ;
@@ -1050,7 +1052,38 @@ void T2DMap::paintEvent( QPaintEvent * e )
10501052 }
10511053 }
10521054 else
1053- p.fillRect (dr,c);
1055+ {
1056+ if ( mBubbleMode )
1057+ {
1058+ float _radius = (rSize*tx)/2 ;
1059+ QPointF _center = QPointF (rx,ry);
1060+ QRadialGradient _gradient (_center,_radius);
1061+ _gradient.setColorAt (0.85 , c);
1062+ _gradient.setColorAt (0 , QColor (255 ,255 ,255 ,255 ));
1063+ QPen myPen (QColor (0 ,0 ,0 ,0 ));
1064+ QPainterPath myPath;
1065+ p.setBrush (_gradient);
1066+ p.setPen (myPen);
1067+ myPath.addEllipse (_center,_radius,_radius);
1068+ p.drawPath (myPath);
1069+ }
1070+ else
1071+ p.fillRect (dr,c);
1072+ }
1073+ if ( mpMap->rooms [pArea->rooms [i]]->highlight )
1074+ {
1075+ float _radius = (mpMap->rooms [pArea->rooms [i]]->highlightRadius *tx)/2 ;
1076+ QPointF _center = QPointF (rx,ry);
1077+ QRadialGradient _gradient (_center,_radius);
1078+ _gradient.setColorAt (0.85 , mpMap->rooms [pArea->rooms [i]]->highlightColor );
1079+ _gradient.setColorAt (0 , mpMap->rooms [pArea->rooms [i]]->highlightColor2 );
1080+ QPen myPen (QColor (0 ,0 ,0 ,0 ));
1081+ QPainterPath myPath;
1082+ p.setBrush (_gradient);
1083+ p.setPen (myPen);
1084+ myPath.addEllipse (_center,_radius,_radius);
1085+ p.drawPath (myPath);
1086+ }
10541087 if ( mShowRoomID )
10551088 {
10561089 QPen __pen = p.pen ();
@@ -1350,29 +1383,31 @@ void T2DMap::paintEvent( QPaintEvent * e )
13501383 qDebug ()<<" render time:" <<__time.elapsed ();
13511384 }
13521385
1353- QMapIterator<int , TMapLabel> it (pArea->labelMap );
1354- while ( it.hasNext () )
1386+ if ( mpMap->mapLabels .contains ( mAID ) )
13551387 {
1356- it.next ();
1357-
1358- QRectF lr = QRectF ( 0 , 0 , 1000 , 100 );
1359- QPixmap pix ( lr.size ().toSize () );
1360- pix.fill (QColor (0 ,0 ,0 ,0 ));
1361- QPainter lp ( &pix );
1362-
1363- lp.fillRect ( lr, it.value ().bgColor );
1364- QPen lpen;
1365- lpen.setColor ( it.value ().fgColor );
1366- lp.setPen ( lpen );
1367- QRectF br;
1368- lp.drawText ( lr, Qt::AlignLeft, it.value ().text , &br );
1369- QPointF lpos;
1370- lpos.setX ( it.value ().pos .x ()*tx+_rx );
1371- lpos.setY ( it.value ().pos .y ()*ty*-1 +_ry );
1372- p.drawPixmap ( lpos, pix, br.toRect () );
1388+ QMapIterator<int , TMapLabel> it (mpMap->mapLabels [mAID ]);
1389+ while ( it.hasNext () )
1390+ {
1391+ it.next ();
1392+
1393+ QRectF lr = QRectF ( 0 , 0 , 1000 , 100 );
1394+ QPixmap pix ( lr.size ().toSize () );
1395+ pix.fill (QColor (0 ,0 ,0 ,0 ));
1396+ QPainter lp ( &pix );
1397+
1398+ lp.fillRect ( lr, it.value ().bgColor );
1399+ QPen lpen;
1400+ lpen.setColor ( it.value ().fgColor );
1401+ lp.setPen ( lpen );
1402+ QRectF br;
1403+ lp.drawText ( lr, Qt::AlignLeft, it.value ().text , &br );
1404+ QPointF lpos;
1405+ lpos.setX ( it.value ().pos .x ()*tx+_rx );
1406+ lpos.setY ( it.value ().pos .y ()*ty*-1 +_ry );
1407+ p.drawPixmap ( lpos, pix, br.toRect () );
13731408
1409+ }
13741410 }
1375-
13761411}
13771412
13781413void T2DMap::mouseDoubleClickEvent ( QMouseEvent * event )
@@ -2414,7 +2449,17 @@ void T2DMap::slot_createLabel()
24142449 my = yspan/2 - my;
24152450 label.pos = QPointF ( mx, my );
24162451 if ( ! mpMap->areas .contains (mAID ) ) return ;
2417- int labelID = mpMap->areas [mAID ]->labelMap .size ();
2418- mpMap->areas [mAID ]->labelMap [labelID] = label;
2452+ int labelID;
2453+ if ( ! mpMap->mapLabels .contains ( mAID ) )
2454+ {
2455+ QMap<int , TMapLabel> m;
2456+ m[0 ] = label;
2457+ mpMap->mapLabels [mAID ] = m;
2458+ }
2459+ else
2460+ {
2461+ labelID = mpMap->mapLabels [mAID ].size ();
2462+ mpMap->mapLabels [mAID ].insert (labelID, label);
2463+ }
24192464}
24202465
0 commit comments