Revision 7c7d95e5

View differences:

ide/org.omnetpp.sequencechart/src/org/omnetpp/sequencechart/widgets/SequenceChart.java
2581 2581
			//long longestEventOffset = 0; //TODO: Make this work to fix error with long events getting not displayed even when they are visible.
2582 2582
			//long[] eventPtrRange = getFirstLastEventPtrForViewportRange(Rectangle.SINGLETON.x - (extraClipping+longestEventOffset), Rectangle.SINGLETON.right() + extraClipping);
2583 2583
			long[] eventPtrRange = getFirstLastEventPtrForViewportRange(0, Rectangle.SINGLETON.right() + extraClipping);
2584
			
2585 2584
			long startEventPtr = eventPtrRange[0];
2586 2585
			long endEventPtr = eventPtrRange[1];
2587 2586
            if (showZeroSimulationTimeRegions)
......
2792 2791
		if (startEventPtr != 0 && endEventPtr != 0) {
2793 2792
	        if (debug)
2794 2793
	            Debug.println("Drawing events with event range: " + sequenceChartFacade.IEvent_getEventNumber(startEventPtr) + " ->: " + sequenceChartFacade.IEvent_getEventNumber(endEventPtr));
2795

  
2796 2794
			//HashMap<Integer, Integer> axisYtoLastX = new HashMap<Integer, Integer>();
2797 2795

  
2798 2796
			// NOTE: navigating through next event takes care about leaving events out which are not in the filter's result
......
2803 2801
	                int x = (int)getEventXViewportCoordinate(eventPtr);
2804 2802
	                int y = getEventYViewportCoordinate(eventPtr);
2805 2803
	               // Integer lastX = axisYtoLastX.get(y);
2806

  
2807 2804
    				// performance optimization: don't draw event if there's one already drawn exactly there
2808 2805
    				//if (lastX == null || lastX.intValue() != x) {
2809 2806
    					//axisYtoLastX.put(y, x);
2810
    					drawEvent(graphics, eventPtr, getEventAxisModuleIndex(eventPtr), x, y);
2807
    				drawEvent(graphics, eventPtr, getEventAxisModuleIndex(eventPtr), x, y);
2811 2808
    				//}
2812 2809
			    }
2813 2810

  
......
2908 2905
	
2909 2906
	private long getNextEventPtrAccordingToTimelineMode(long eventPtr) {
2910 2907
		IEvent e = sequenceChartFacade.IEvent_getEvent(eventPtr);
2911
		if (e == null) {
2912
			System.out.println("nullpointer!");
2913
			
2914
		}
2915 2908
		e = getNextEventAccordingToTimelineMode(e);
2916 2909
		if (e == null) {
2917 2910
			return 0;
......
3981 3974
		if (eventLog == null || eventLog.isEmpty() || eventLog.getApproximateNumberOfEvents() == 0)
3982 3975
			return new long[] {0, 0};
3983 3976
		else {
3984
			//TODO: speed this up
3985
			//Fix for REAL_TIME Visualization:
3986
			//In this mode, events are not necessarily ordered in event number order so 
3977
			//Fix for REAL_TIME Visualization (not necessary anymore):
3978
			//In this mode, events are not ne cessarily ordered in event number order so 
3987 3979
			//that an interval of visible events may not be correct.
3988 3980
			//fix it by just returning the interval of all events.
3989
			if (getTimelineMode() == TimelineMode.REAL_TIME){
3981
			/*if (getTimelineMode() == TimelineMode.REAL_TIME){
3990 3982
				return new long[] { eventLog.getFirstEventRealTime().getCPtr(), eventLog.getLastEventRealTime().getCPtr() };
3991
			}
3983
			}*/
3992 3984
			
3993 3985
    		double leftTimelineCoordinate = getTimelineCoordinateForViewportCoordinate(x1);
3994 3986
    		double rightTimelineCoordinate = getTimelineCoordinateForViewportCoordinate(x2);
3995

  
3996 3987
    		IEvent startEvent = sequenceChartFacade.getLastEventNotAfterTimelineCoordinate(leftTimelineCoordinate);
3997 3988
    		if (startEvent == null) {
3998 3989
    			if (getTimelineMode() == TimelineMode.REAL_TIME) {
src/eventlog/event.h
88 88

  
89 89
        virtual eventnumber_t getEventNumber() { return eventEntry->eventNumber; }
90 90
        virtual simtime_t getSimulationTime() { return eventEntry->simulationTime; }
91
        virtual long getComplexity() { return !eventEndEntry ? 1 : eventEndEntry->complexity; }
91
        virtual long getComplexity() { return !eventEndEntry ? 0 : eventEndEntry->complexity; }
92 92
        virtual int getModuleId() { return eventEntry->moduleId; }
93 93
        virtual long getMessageId() { return eventEntry->messageId; }
94 94
        virtual eventnumber_t getCauseEventNumber() { return eventEntry->causeEventNumber; }
src/eventlog/ievent.cc
26 26
    criticalPredecessor = NULL;
27 27
    cachedTimelineCoordinate = -1;
28 28
    cachedTimelineCoordinateSystemVersion = -1;
29
    _earliestProcessingTime = 0;
29 30
}
30 31

  
31 32
int IEvent::findBeginSendEntryIndex(int messageId)
src/eventlog/sequencechartfacade.cc
321 321
        {
322 322
            IEvent* res = eventLog->getFirstEventRealTime();
323 323
            for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
324
                if ((double) current->getEarliestProcessingTime() / 1000000.0 < timelineCoordinate) {
324
                if ((double) current->getEarliestProcessingTime() / 1000000.0 < timelineCoordinate + timelineCoordinateOriginRealTime) {
325 325
                    if (current->getEarliestProcessingTime() > res->getEarliestProcessingTime()) {
326 326
                        res = current;
327 327
                    }
......
366 366
        case REAL_TIME:
367 367
        {
368 368
            IEvent* res = eventLog->getLastEventRealTime();
369
            for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
370
                if ((double) current->getEarliestStartTime() / 1000000.0 > timelineCoordinate) {
369
            for (IEvent *current = eventLog->getLastEventRealTime(); current; current = current->getPreviousEventRealTime()) {
370
                if ((double) current->getEarliestStartTime() / 1000000.0 > timelineCoordinate + timelineCoordinateOriginRealTime) {
371 371
                    if (current->getEarliestStartTime() < res->getEarliestStartTime()) {
372 372
                        res = current;
373 373
                    }
......
961 961
        if(current->getEventEndEntry()) {
962 962
            current->_earliestProcessingTime = current->getComplexity();
963 963
        }
964
        printf("%i \n", current->getEventNumber());
965 964
        current->setCriticalPredecessor(eventLog->getFirstEvent());
966 965
        for (IEvent *antecessor = eventLog->getFirstEvent(); antecessor; antecessor = antecessor->getNextEvent()) {
967 966
            if(antecessor==current) {
......
1156 1155

  
1157 1156
bool compare_events_realtime (IEvent* a, IEvent* b)
1158 1157
{
1159
  return a->getEarliestStartTime() <= b->getEarliestStartTime();
1158
  return (a->getEarliestStartTime() < b->getEarliestStartTime() || (a->getEarliestStartTime() == b->getEarliestStartTime() && a->getEventNumber() < b->getEventNumber()));
1160 1159
}
1161 1160

  
1162 1161

  
......
1184 1183
    //Set last event in eventlog
1185 1184
    eventLog->setLastEventRealTime((Event*)prev);
1186 1185
    //Test:
1186
    /*
1187 1187
    for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
1188 1188
        printf("event %i, simtime %f, time %i \n",current->getEventNumber(), current->getSimulationTime().dbl(), current->getEarliestStartTime());
1189
    }
1189
    }*/
1190 1190

  
1191 1191

  
1192 1192
}

Also available in: Unified diff