[[PageOutline]] = Introduction = This is a central location for users to share useful code snippets for FDO. Make sure that you read the FDO Cookbook chapter of the FDO Developers Guide as well. == Snippets == Eventually, we'll add categories to these. For now, just pick the one you're interested in... * [wiki:CodeSamples/GetDynamicExtents Retrieving spatial extents from providers that support dynamic extents] * [wiki:CodeSamples/GetStaticExtents Retrieving spatial extents from providers that do not support dynamic extents] == Creating New Snippets == === Page Title === When creating a new page, please use the following convention for the page location: !CodeSnippets/YourPageName for example: !CodeSnippets/AJAXViewerEventHooking This is to ensure that pages are easily found via the TitleIndex, and may allow for an automated index at some point. You 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. === Header Section === Please 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. For an easier approach, download the plain text version of any existing CodeSnippet (see the bottom of each page) to start from. {{{ [[PageOutline]] This page is an FDO Code Snippet. Visit the CodeSnippets page to view more! }}} === Syntax Highlighting === Trac 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: {{{ #!cpp while (reader.ReadNext()) { extentAsByteArr = reader.GetExtent(); // if extent type is dynamic and no geometries have been added // the extent can be null if (extentAsByteArr != null) { geom = geomFactory.CreateGeometryFromFgf(extentAsByteArr); extentAsText = geom.Text; } else { extentAsText = "No extent found"; } } }}} Please use this where possible to make your inline examples more readable. === Conventions === * Please try to provide both C++ and C# examples of your snippets if possible * Please use two-space indents, and indent your entire code block by two spaces for enhanced readability. * If you want, you can add a Contributors section to your snippet for a little bit of fame.