Add origin comment
[viking/guyou.git] / HACKING
blob59902651f921356c83bedf0cf41ba2f354f2d82d
1 Naming:
2 A "module" is a .c file.
4 Functions starting with "vik_" operate on an object/structure with the module name (see layer.c for an example).
5 Functions starting with "a_" do not, these modules may have static variables.
6 Both are followed by the module name. Unless of course the function is static, in which case it may be called anything.
8 All (well, practically all) global constants and macros start with "VIK_" and then the module name.
10 ----
12 The layers panel holds all the layers. Layers connect to the layers panel via what I call "interfaces" which are really just a 
13 structure of function pointers and pointers to other bits such as icons. viklayer.c switches between the layers like 
14 polymorhpism. Anything specific to the layer should (in theory) be found solely in that layer's source file.
16 There are some ugly hacks in here, like the layers panel holding the viewport and each layer holding the viewport and a 
17 GtkTreeIter. Unfortunately it was the only way I could figure out to do some things. It would be _much_ easier with a 
18 object-oriented language.
20 ---
22 "xmpp" and "ympp" are really misnomers, as they only represent the Meters Per Pixel in UTM mode. Otherwise they are an artificial
23 zooming system. In expedia mode it represents the "Alti", in Google mode it represents 2^(scale), e.g. 2^0 = 1, 2^8 = 256.
25 ---
26 Implementing a MapSource
28 VikMapSource is the "interface", the really base class of the MapSource tree.
29 In order to implement a MapSource, you have to prefer to derive from VikMapSourceDefault, a less abstract class, adding a property based implementation for some aspects of the VikMapSource interface.
30 Then, you have to provide implementation for coord_to_mapcoord, mapcoord_to_center_coord and download methods.