Beispiel #1
0
void StaticButton::enterEvent(QEvent *)
{
    setButtonStatus(BUTTON_ENTER);
    if(m_isCursor)
    {
        m_preCursor = cursor();
        setCursor(Qt::OpenHandCursor);
    }
    emit enterSignal();
}
Beispiel #2
0
void lhpControl::decision()
{
	
	// the intro is locking out other behavior
	if(introLockFlag == 1) { // 3) introFinsihed?	
		status = 0;
		prevCheckID = 10;			
		// printf("decision: 3 NO %d/%d\n", status, prevCheckID);
		return;
	}
	
	calcNeighbourRelationship(); // calc distance and bearing of each zone to current position
	makeZoneRanking(); // calc ranking based on proximity, closest first
	
	// in this section all logic is inverted, in order to fall back to 2) without a jump in code !!!!

	// printf("start of decision ----- %d/%d---------------\n", status, prevCheckID);
	// printf("relPosition is %f %f\n", map->currentRelativePosition.x, map->currentRelativePosition.y);

	if(status < 1 || status > 7) {				// 1) statusCheck: NO
		// printf("decision: 1 NO %d/%d\n", status, prevCheckID);
		if(insidePerimeter() == 0) {			// 8) insidePerimeter: NO (A-B)
			// printf("decision: 8 NO%d/%d\n", status, prevCheckID);
			if(prevCheckID == 16) {				// 16) statusChanged: NO
				// printf("decision: 16 NO %d/%d\n", status, prevCheckID);
				return;
			} else {							// 16) statusChanged: YES
				// printf("decision: 16 YES %d/%d\n", status, prevCheckID);
				if(status == -1 || status == 0 || status == 8){	// 17) entering: NO
					// printf("decision: 17 NO %d/%d : 8/16\n", status, prevCheckID);
					status = 8;
					prevCheckID = 16;
					leavePerimeter();			// ### ACTION leave perimeter ###
					return;
				} else {							// 17) entering: YES
					// printf("decision: 17 YES %d/%d : x 16\n", status, prevCheckID);
					prevCheckID = 16;
					return;
				}
			}
		} else {								// 8) YES insidePerimeter
			// printf("decision: 8 YES %d/%d\n", status, prevCheckID);
			if(prevCheckID == 10) {				// 10 A) statusChanged: NO
				// printf("decision: 10A NO %d/%d : 1/10\n", status, prevCheckID);
				status = 1;
				prevCheckID = 10;
				enterPerimeter();				// ### ACTION enter perimeter ###
				return;
			} else {								// 10 A) statusChanged: YES
				// printf("decision: 10A YES %d/%d\n", status, prevCheckID);
				if(status < 1) {				// 9) statusCheck: NO
					// printf("decision: 9 NO %d/%d\n", status, prevCheckID);
					if(prevCheckID == 11){		// 11) statusChanged: NO
						// printf("decision: 10B NO %d/%d\n", status, prevCheckID);
						return;
					} else {						// 11) statusChanged: YES 
						// printf("decision: 10B YES %d/%d : 0/10\n", status, prevCheckID);
						status = 0;
						prevCheckID = 10;
						enterPerimeterFirst();	// ### ACTION enter perimeter first time ###
						return;
					}
				}								// 9) statusCheck: YES -> continues to 3)
			}
		}
	} else {										// 1) statusCheck: YES 
		// printf("decision: 1 YES %d/%d\n", status, prevCheckID);
	}
	
	// in this section all logic is reverted to normal !!!!
	if(insideSignal() == 1) {						// 2) insideID: YES 
		// printf("decision: 2 YES %d/%d\n", status, prevCheckID);
		if(insideAtmo() == 1) {					// 4) insideAtmo: YES
			// printf("decision: 4 YES %d/%d\n", status, prevCheckID);
			if(insideScene() == 1) {			// 6) insideScene: YES
				// printf("decision: 6 YES %d/%d\n", status, prevCheckID);
				if(prevCheckID != 7) {			// 7) statusChanged: YES
					// printf("decision: 7 YES %d/%d : 4/7 \n", status, prevCheckID);
					status = 4;
					prevCheckID = 7;
					enterScene();				// ### ACTION enter scene ###
					return;
				} else {							// 7) statusChanged: NO
					// printf("decision: 7 NO %d/%d\n", status, prevCheckID);
					return;
				}
			} else {							// 6) inside Scene: NO
				// printf("decision: 6 NO %d/%d\n", status, prevCheckID);
				if(prevCheckID != 14) {			// 14) statusChanged: YES
					// printf("decision: 14 YES %d/%d\n", status, prevCheckID);
					if(status != 4) {			// 15) entering: YES
						// printf("decision: 15 YES %d/%d : 3/14\n", status, prevCheckID);						
						status = 3;
						prevCheckID = 14;
						enterAtmo();			// ### ACTION enter atmo ###
						return;
					} else {						// 15) entering: NO
						// printf("decision: 15 NO %d/%d : 5/14\n", status, prevCheckID);
						status = 5;
						prevCheckID = 14;
						leaveScene();			// ### ACTION leave scene ###
						return;
					}
				} else {						// 14) statusChanged: NO
					// printf("decision: 14 NO %d/%d\n", status, prevCheckID);
					return;
				}
			}
		} else {								// 4) insideAtmo: NO
			// printf("decision: 4 NO %d/%d\n", status, prevCheckID);
			if(prevCheckID != 12) {				// 12) statusChanged: YES
				// printf("decision: 12 YES %d/%d\n", status, prevCheckID);
				if(status < 3 || status > 5) {	// 13 entering: YES
					// printf("decision: 13 YES %d/%d : 2/12\n", status, prevCheckID);
					status = 2;
					prevCheckID = 12;
					enterSignal();					// ### ACTION enter Signal ###
					return;
				} else {						// 13 entering:  NO
					// printf("decision: 13 NO %d/%d : 6/12\n", status, prevCheckID);
					status = 6;
					prevCheckID = 12;
					leaveAtmo();				// ### ACTION leave Atmo ###
					return;
				}
			} else {							// 12) statusChanged: NO
				// printf("decision: 12 NO %d/%d\n", status, prevCheckID);
				prevCheckID = 12;
				moreSignalChecks();					// ### ACTION more ID checks (for overlap of signals) ###
				return;
			}
		}
	} else {									// 2) insideSignal: NO
		// printf("decision: 2 NO %d/%d\n", status, prevCheckID);
		if(prevCheckID != 10) {					// 10 C) statusChanged: YES
			// printf("decision: 10C YES %d/%d\n", status, prevCheckID);
			if(status < 2 || status > 6) {		// 11) entering: YES
				// printf("decision: 11 YES %d/%d : 1/10\n", status, prevCheckID);
				status = 1;
				prevCheckID = 10;
				enterPerimeter();				// ### ACTION enter perimeter ###
				return;
			} else {							// 11) entering: NO
				// printf("decision: 11 NO %d/%d : 7/10\n", status, prevCheckID);
				status = 7;
				prevCheckID = 10;
				leaveSignal();					// ### ACTION leave Signal ###
				return;
			}
		} else {								// 10) statusChanged: NO
			// printf("decision: 10C NO %d/%d\n", status, prevCheckID);
			if(insidePerimeter() == 1) {		// 19) insidePerimeter: YES
				// printf("decision: 19 YES %d %d\n", status, prevCheckID);
				return;
			} else {							// 19) insidePerimeter: NO
				// printf("decision: 19 NO %d %d : 8 10\n", status, prevCheckID);
				status = 8;
				prevCheckID = 10;
				leavePerimeter();				// ### ACTION leave perimter ###
				return;
			}
		}
	}
	return;
}