summaryrefslogtreecommitdiff
path: root/SDL_Android/SmartDeviceLinkProxyAndroid/src/com/smartdevicelink/proxy/rpc/Turn.java
blob: a4ec2dca0e0ba490bd6fede036211b34b4aef849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.smartdevicelink.proxy.rpc;

import java.util.Hashtable;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.constants.Names;

/**
 * Describes a navigation turn including an optional icon
 * <p><b>Parameter List
 * <table border="1" rules="all">
 * 		<tr>
 * 			<th>Name</th>
 * 			<th>Type</th>
 * 			<th>Description</th>
 * 			<th>SmartDeviceLink Ver. Available</th>
 * 		</tr>
 * 		<tr>
 * 			<td>navigationText</td>
 * 			<td>String</td>
 * 			<td>Text to describe the turn (e.g. streetname)
 *				 <ul>
 *					<li>Maxlength = 500</li>
 *				 </ul> 
 * 			</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 * 		<tr>
 * 			<td>turnIcon</td>
 * 			<td>Image</td>
 * 			<td>Image to be shown for a turn
 * 			</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 *  </table>
 * @since SmartDeviceLink 2.0
 */
public class Turn extends RPCStruct {

	/**
	 * Constructs a newly allocated Turn object
	 */
	public Turn() { }
	
	/**
	 * Constructs a newly allocated Turn object indicated by the Hashtable parameter
	 * @param hash The Hashtable to use
	 */
    public Turn(Hashtable hash) {
        super(hash);
    }
    
    /**
     * set the text to describe the turn (e.g. streetname)
     * @param navigationText the text to describe the turn (e.g. streetname)
     */
    public void setNavigationText(String navigationText) {
        if (navigationText != null) {
            store.put(Names.navigationText, navigationText);
        } else {
        	store.remove(Names.navigationText);
        }
    }
    
    /**
     * get the text to describe the turn (e.g. streetname)
     * @return the text to describe the turn (e.g. streetname)
     */
    public String getNavigationText() {
        return (String) store.get(Names.navigationText);
    }
    
    /**
     * set Image to be shown for a turn
     * @param turnIcon the image to be shown for a turn
     */
    public void setTurnIcon(Image turnIcon) {
        if (turnIcon != null) {
        	store.put(Names.turnIcon, turnIcon);
        } else {
        	store.remove(Names.turnIcon);
        }
    }
    
    /**
     * get the image to be shown for a turn
     * @return the image to be shown for a turn
     */
    public Image getTurnIcon() {
    	Object obj = store.get(Names.turnIcon);
        if (obj instanceof Image) {
            return (Image) obj;
        } else {
        	return new Image((Hashtable) obj);
        }
    }
}