Changes between Initial Version and Version 1 of CodeSnippets


Ignore:
Timestamp:
10/15/08 09:01:19 (16 years ago)
Author:
jbirch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodeSnippets

    v1 v1  
     1[[PageOutline]]
     2
     3= Introduction =
     4
     5This is a central location for users to share useful code snippets for FDO.
     6
     7== Snippets ==
     8
     9 * [wiki:CodeSamples/GetDynamicExtents Retrieving spatial extents from providers that support dynamic extents]
     10 * [wiki:CodeSamples/GetStaticExtents Retrieving spatial extents from providers that do not support dynamic extents]
     11
     12== Creating New Snippets ==
     13
     14=== Page Title ===
     15
     16When creating a new page, please use the following convention for the page location:
     17
     18  !CodeSnippets/YourPageName
     19
     20for example:  !CodeSnippets/AJAXViewerEventHooking
     21
     22This is to ensure that pages are easily found via the TitleIndex, and may allow for an automated index at some point.
     23
     24You can easily do this by editing this CodeSnippets page, copying another entry, and then modifying it to fit your title.  Once you have saved the page, you will have a handy link to follow to edit your own snippet.
     25
     26=== Header Section ===
     27
     28Please include the following on every Code Snippet page.  It allows users to easily navigate the page, and if they come from a search engine they can get to the snippets index more easily.
     29
     30{{{
     31
     32[[PageOutline]]
     33
     34This page is an FDO Code Snippet.  Visit the CodeSnippets page to view more!
     35
     36}}}
     37
     38=== Syntax Highlighting ===
     39
     40Trac has some really cool [wiki:WikiProcessors syntax highlighting] built into it.  The FDO Trac doesn't have all of these set up, but at least the C++ one works (add #!cpp to the top of your code block), and does a reasonable job with typical FDO code highlighting.  For example:
     41
     42{{{
     43#!cpp
     44while (reader.ReadNext()) {
     45        extentAsByteArr = reader.GetExtent();
     46      // if extent type is dynamic and no geometries have been added
     47      // the extent can be null
     48      if (extentAsByteArr != null)
     49      {
     50        geom = geomFactory.CreateGeometryFromFgf(extentAsByteArr);
     51        extentAsText = geom.Text;
     52      }
     53      else
     54      {
     55        extentAsText = "No extent found";
     56      }
     57}
     58}}}
     59
     60Please use this where possible to make your inline examples more readable.